declare namespace denostd { export namespace testing { export namespace bench { /** * @deprecated Use `Deno.bench()` instead. See https://doc.deno.land/deno/unstable/~/Deno.bench * for details. * * Registers a benchmark as a candidate for the runBenchmarks executor. */ export function bench(benchmark: BenchmarkDefinition | BenchmarkFunction): void; /** Defines clearBenchmark's constraints by matching benchmark names. */ export interface BenchmarkClearOptions { /** Only benchmarks which name match this regexp will be removed */ only?: RegExp; /** Benchmarks which name match this regexp will be kept */ skip?: RegExp; } /** Defines a benchmark definition with configurable runs. */ export interface BenchmarkDefinition { func: BenchmarkFunction; name: string; /** Defines how many times the provided `func` should be benchmarked in succession */ runs?: number; } /** Defines a benchmark through a named function. */ export interface BenchmarkFunction { (b: BenchmarkTimer): void | Promise; name: string; } /** Defines the result of a single benchmark */ export interface BenchmarkResult { /** The name of the benchmark */ name: string; /** The total time it took to run a given benchmark */ totalMs: number; /** Times the benchmark was run in succession. */ runsCount: number; /** The average time of running the benchmark in milliseconds. */ measuredRunsAvgMs: number; /** The individual measurements in milliseconds it took to run the benchmark.*/ measuredRunsMs: number[]; } export class BenchmarkRunError extends Error { benchmarkName?: string; constructor(msg: string, benchmarkName?: string); } /** Defines runBenchmark's run constraints by matching benchmark names. */ export interface BenchmarkRunOptions { /** Only benchmarks which name match this regexp will be run*/ only?: RegExp; /** Benchmarks which name match this regexp will be skipped */ skip?: RegExp; /** Setting it to true prevents default benchmarking progress logs to the commandline*/ silent?: boolean; } /** Defines the current progress during the run of `runBenchmarks` */ export interface BenchmarkRunProgress extends BenchmarkRunResult { /** List of the queued benchmarks to run with their name and their run count */ queued?: Array<{ name: string; runsCount: number; }>; /** The currently running benchmark with its name, run count and the already finished measurements in milliseconds */ running?: { name: string; runsCount: number; measuredRunsMs: number[]; }; /** Indicates in which state benchmarking currently is */ state?: ProgressState; } /** Defines the result of a `runBenchmarks` call */ export interface BenchmarkRunResult { /** How many benchmark were ignored by the provided `only` and `skip` */ filtered: number; /** The individual results for each benchmark that was run */ results: BenchmarkResult[]; } /** Provides methods for starting and stopping a benchmark clock. */ export interface BenchmarkTimer { start: () => void; stop: () => void; } /** * @deprecated Use `Deno.bench()` instead. See https://doc.deno.land/deno/unstable/~/Deno.bench * for details. * * Clears benchmark candidates which name matches `only` and doesn't match `skip`. * Removes all candidates if options were not provided */ export function clearBenchmarks({ only, skip, }?: BenchmarkClearOptions): void; /** Defines the states `BenchmarkRunProgress` can be in */ export enum ProgressState { BenchmarkingStart = "benchmarking_start", BenchStart = "bench_start", BenchPartialResult = "bench_partial_result", BenchResult = "bench_result", BenchmarkingEnd = "benchmarking_end" } /** * @deprecated Use `Deno.bench()` instead. See https://doc.deno.land/deno/unstable/~/Deno.bench * for details. * * Runs all registered and non-skipped benchmarks serially. * * @param [progressCb] provides the possibility to get updates of the current progress during the run of the benchmarking * @returns results of the benchmarking */ export function runBenchmarks({ only, skip, silent }?: BenchmarkRunOptions, progressCb?: (progress: BenchmarkRunProgress) => void | Promise): Promise; export { } } } }