Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/deno/cli/tsc/dts/lib.deno.ns.d.ts>Deno.BenchDefinition

A modern runtime for JavaScript and TypeScript.
Latest
interface Deno.BenchDefinition
import { type Deno } from "https://deno.land/x/deno@v2.0.4/cli/tsc/dts/lib.deno.ns.d.ts";
const { BenchDefinition } = Deno;

The interface for defining a benchmark test using Deno.bench.

Properties

fn: (b: BenchContext) => void | Promise<void>

The test function which will be benchmarked.

name: string

The name of the test, which will be used in displaying the results.

optional
ignore: boolean

If truthy, the benchmark test will be ignored/skipped.

optional
group: string

Group name for the benchmark.

Grouped benchmarks produce a group time summary, where the difference in performance between each test of the group is compared.

optional
baseline: boolean

Benchmark should be used as the baseline for other benchmarks.

If there are multiple baselines in a group, the first one is used as the baseline.

optional
only: boolean

If at least one bench has only set to true, only run benches that have only set to true and fail the bench suite.

optional
sanitizeExit: boolean = true

Ensure the bench case does not prematurely cause the process to exit, for example via a call to Deno.exit.

optional
permissions: PermissionOptions = "inherit"

Specifies the permissions that should be used to run the bench.

Set this to "inherit" to keep the calling thread's permissions.

Set this to "none" to revoke all permissions.