UNPKG

@thi.ng/bench

Version:

Benchmarking & profiling utilities w/ various statistics & formatters (CSV, JSON, Markdown etc.)

18 lines 665 B
import type { TimingResult } from "./api.js"; /** * Calls function `fn` without args, prints elapsed time and returns * fn's result. The optional `prefix` will be displayed with the output, * allowing to label different measurements. * * @param fn - function to time * @param prefix - log prefix */ export declare const timed: <T>(fn: () => T, prefix?: string) => T; /** * Similar to {@link timed}, but produces no output and instead returns * tuple of `fn`'s result and the time measurement (in milliseconds). * * @param fn - function to time */ export declare const timedResult: <T>(fn: () => T) => TimingResult<T>; //# sourceMappingURL=timed.d.ts.map