TS-Scribe - v0.6.2
    Preparing search index...

    Function benchmark

    • A function that benchmarks another function by measuring its execution time and the size of its result.

      Type Parameters

      • T

        The type of the result returned by the benchmarked function.

      Parameters

      • fn: () => T | Promise<T>

        The function to benchmark. It can return either a synchronous or asynchronous result.

      • options: BenchmarkOptions<T> = {}

        Optional configuration options for the benchmark.

      Returns T | Promise<T>

      The result of the benchmarked function (either synchronously or as a Promise).

      benchmark(() => myFunction(), { label: "My Function Benchmark", onBenchmarkComplete: (info) => {
      console.log(info);
      }});