/*! jsbt - MIT License (c) 2020 Paul Miller, 2010-2016 Mathias Bynens, John-David Dalton, Robert Kieffer from JSLitmus.js */ /** * Benchmark JS projects with nanosecond resolution. * * - Precise: 1ns resolution using `process.hrtime` * - Lightweight: ~200 lines of code, no dependencies - to not interfere with benchmarked code * - Readable: utilizes colors and nice units, shows rel. margin of error only if it's high * * @module */ export type BenchStats = { stats: { rme: number; min: bigint; max: bigint; mean: bigint; median: bigint; formatted: string; }; perSecStr: string; perSec: bigint; perItemStr: string; measurements: bigint[]; }; export type CbFn = (iter?: number) => {}; declare function logMem(): void; declare function formatDuration(duration: any): string; declare function calcStats(list: bigint[]): { rme: number; min: bigint; max: bigint; mean: bigint; median: bigint; formatted: string; }; declare const getTime: () => bigint; declare function benchmarkRaw(callback: CbFn, maxRunTime?: bigint): Promise; export type BenchOpts = { /** Bytes processed by one benchmark iteration; printed as kib/mib/gib per second. */ bytes?: number; /** Custom units processed by one benchmark iteration. */ throughput?: BenchThroughput; /** Per-benchmark runtime in seconds. Defaults to 0.4. */ maxRunTimeSec?: number; mode?: 'normal' | 'runOnce'; }; export type BenchThroughput = { amount: number; unit: string; }; export declare function section(title?: string): void; declare function setMaxRunTime(val: number): void; export declare function bench(label: string, fn: CbFn, opts?: BenchOpts): Promise; export default bench; export declare const utils: { getTime: typeof getTime; logMem: typeof logMem; setMaxRunTime: typeof setMaxRunTime; formatDuration: typeof formatDuration; calcStats: typeof calcStats; benchmarkRaw: typeof benchmarkRaw; };