Skip to main content

Function: benchmark()

benchmark(name, fn): undefined | Promise<Result[]>

Registers a new benchmark to run. If inside a suite callback, it will be added to the suite. Otherwise, it will run immediately.

Parameters

name: string

The name of the benchmark.

fn

Callback to register variations and update the benchmark.

Returns

undefined | Promise<Result[]>

If not inside a suite, the results of the benchmark. Result[]. Else, void.

Defined in

src/benchmark-runner.ts:30