Skip to main content
Deno.BenchContext.end - Deno documentation
method Deno.BenchContext.end
BenchContext.end(): void

End the timer early for the bench measurement. This should be called before doing teardown work which should not be measured.

Warning: This method should not be used for benchmarks averaging less than 10μs per iteration. In such cases it will be disabled but the call will still have noticeable overhead, resulting in a warning.

Deno.bench("foo", async (t) => {
  using file = await Deno.open("data.txt");
  t.start();
  // some operation on `file`...
  t.end();
});

Return Type

void