tachometer
Version:
Web benchmark runner
67 lines (66 loc) • 2.41 kB
TypeScript
/**
* @license
* Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at
* http://polymer.github.io/LICENSE.txt The complete set of authors may be found
* at http://polymer.github.io/AUTHORS.txt The complete set of contributors may
* be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by
* Google as part of the polymer project is also subject to an additional IP
* rights grant found at http://polymer.github.io/PATENTS.txt
*/
import { BenchmarkResult } from './types';
export interface ConfidenceInterval {
low: number;
high: number;
}
export interface SummaryStats {
size: number;
mean: number;
meanCI: ConfidenceInterval;
variance: number;
standardDeviation: number;
relativeStandardDeviation: number;
}
export interface ResultStats {
result: BenchmarkResult;
stats: SummaryStats;
}
export interface ResultStatsWithDifferences extends ResultStats {
differences: Array<Difference | null>;
}
export interface Difference {
absolute: ConfidenceInterval;
relative: ConfidenceInterval;
}
export declare function summaryStats(data: number[]): SummaryStats;
/**
* Return whether the given confidence interval contains a value.
*/
export declare function intervalContains(interval: ConfidenceInterval, value: number): boolean;
export interface Horizons {
absolute: number[];
relative: number[];
}
/**
* Return whether all difference confidence intervals are unambiguously located
* on one side or the other of all given horizon values.
*
* For example, given the horizons 0 and 1:
*
* <---> true
* <---> false
* <---> true
* <---> false
* <---> true
* <-----------> false
*
* |-------|-------|-------| ms difference
* -1 0 1 2
*/
export declare function horizonsResolved(resultStats: ResultStatsWithDifferences[], horizons: Horizons): boolean;
/**
* Given an array of results, return a new array of results where each result
* has additional statistics describing how it compares to each other result.
*/
export declare function computeDifferences(stats: ResultStats[]): ResultStatsWithDifferences[];
export declare function computeDifference(a: SummaryStats, b: SummaryStats): Difference;