Reference
bench.config.ts bench.config(5)
The configuration file of measure: 17 keys, each generated from the schema that validates it and the TSDoc that explains it.
Name
bench.config.ts — the configuration measure -c reads
Synopsis
import { defineConfig } from "@ac-bench/cli";
import durationPlugin from "@ac-bench/measure-duration/plugin";
export default defineConfig({
plugins: [durationPlugin],
reporters: ["table", "json"],
mode: "standard",
baseline: { maxRegression: 0.03 },
});Description
A TypeScript or JavaScript module whose default export is the configuration, typed by defineConfig. There is no default file: measure reads one only when -c names it, and otherwise applies every default.
Every key is optional. A command-line flag overrides the key it stands for; the key overrides the default. The export is validated when it is loaded: an unknown or ill-typed field is reported by its path (gates.0.denominators: …) and measure exits 4 before anything starts.
Keys
Glob patterns for bench files. Default: ["**/*.bench.ts"]
Glob patterns to exclude. Default: ["node_modules/**"]
Ids of the reporters to run, in output order. Default: ["table"]. Also
settable with --reporter.
"table", "json", "markdown", "csv", "junit", "run-json" and
"summary" resolve to the reporters this CLI ships, with their default
options; any other id must name a reporter plugin listed in plugins.
Listing a reporter in plugins configures it, it does not select it — that
way --reporter csv can turn on a reporter this file has already
configured.
Default output base name (without extension) for file reporters.
Default sampling options per measure id, under each condition’s own: { duration: { minRuns: 20, maxTimeMs: 5000 }, resource: { warmup: 5 } }.
Duration and resource read them; a key a measure does not know is ignored.
Measure, reporter and runtime plugins available to this run.
Import each package directly and list what it exports: a package that takes
options exports a factory (jsonReporter({ output })), one that does not
exports the plugin (durationPlugin, tableReporter). The CLI never
imports a measure package itself.
Ids of the runtimes to measure in, one after another in this order.
Default: ["node"].
"node" resolves to nodeRuntime() with its default options; any other id
must name a runtime plugin listed in plugins, which configures it without
selecting it, as for reporters.
Modules imported inside every child before the bench file, in order.
beforeAll/afterAll are condition-scoped and nothing wider exists, so
this is the only per-child setup mechanism. Its cost is paid once per fork
unit rather than once per run — which is what asking for it means when no
state crosses a process boundary.
Time without any message from a child before it is considered stuck. Default 30_000. Reset by every message it sends.
Wall-clock cap on one fork unit. Default 0, meaning no cap.
Wall-clock cap on the whole run, retries and cooldown included. Default
0, meaning no cap. Also settable with --max-total-time.
How much rigour to apply. Default "standard". Also settable with
--mode, which is the intended way in.
Pins individual measurement-plan parameters, overriding what mode
derives.
For a run that must reproduce an exact plan rather than express an intent —
a published comparison, or a CI job that has to stay comparable with last
month’s. Everyone else should use mode.
| key | type | meaning |
|---|---|---|
replicates | integer ≥ 1 |
Differences between cases measured in the same process are paired, so the process-level offset cancels. Replicating gives that offset a distribution instead of one unknown draw. |
maxReplicates | integer ≥ 1 | Ceiling on A plan that starts cheap buys more processes only for a comparison its intervals have not settled, and only up to here. |
isolatedRuns | integer ≥ 0 |
The only way to tell “this case is slow” from “this case is slow after the one before it”. Costs an execution of every ancestor hook per case, so it stays small and off by default. |
rounds | integer ≥ 1 |
Above 1 the cases interleave, one measured slice each in turn, so none of them owns a single stretch of the process’s life. At 1 they run to completion one after another, and the first case measured gets the cold interpreter while the last gets the warm one. |
cooldown | boolean | Wait for the machine to settle before each attempt. |
retryOnInstability | integer ≥ 0 | Re-runs of a condition whose environment verdict was |
Seeds replicate and case ordering. Default: derived from the clock, so each run randomises differently. Pin it to reproduce a run exactly.
Gates that span suites, apply to many suites at once, or belong to the run rather than the code. Each reference is a glob per segment; one matching nothing is a usage error (exit 4) before anything is measured.
The gates’ statistics and escalation (confidence, multiplicity, …).
| key | type | meaning |
|---|---|---|
confidence | number > 0 < 1 | Two-sided confidence of each interval before multiplicity. Default 0.95. |
multiplicity | "holm" | "bonferroni" | "none" | Family-wise adjustment over every hypothesis of the run. Default |
pooling | "hartung-knapp" | "dersimonian-laird" | Interval across executions. Default |
maxDispersion | number > 0 | Upper limit on the combined within-execution dispersion (relative MAD); above it a gate is inconclusive whatever its interval says. Default: none. |
minExecutions | integer ≥ 1 | Fewest executions per subject before a gate may be decided. Default 3. |
escalate | boolean | Buy replicates while a fork unit’s gate is undecided. Default true. |
How the run records and compares with baselines.
| key | type | meaning |
|---|---|---|
directory | string | Where |
maxRegression | number ≥ 0 | Default of |
normalizeBy | string | object | The case every baseline comparison is divided by, so machine speed
cancels: what |
Examples
measure -c bench.config.ts --list