Skip to content

Configuration

as-bench.config.json is auto-discovered in the current directory; point elsewhere with --config <path>. A JSON schema ships at node_modules/as-bench/as-bench.config.schema.json for editor autocomplete.

json
{
  "$schema": "./node_modules/as-bench/as-bench.config.schema.json",
  "input": ["assembly/__benches__/**/*.ts"],
  "outDir": ".as-bench/build",
  "baselineDir": ".as-bench/baselines",
  "runtime": "node",
  "verbose": false,
  "deterministic": false,
  "settings": {
    "warmupTime": 3000,
    "measurementTime": 3000,
    "sampleSize": 0,
    "numResamples": 100000
  },
  "render": { "significanceLevel": 0.05, "noiseThreshold": 0.01 },
  "buildOptions": { "optimize": true, "debug": false, "args": [] },
  "profile": { "top": 10, "all": false, "iters": 10, "minInstrs": 4 },
  "modes": {
    "quick": { "settings": { "warmupTime": 250, "measurementTime": 500, "numResamples": 20000 } }
  }
}

Precedence: defaults < config < mode < CLI flags. See Modes.

Top-level keys

KeyTypeDescription
inputstring[]Glob(s) for bench files (default assembly/__benches__/**/*.ts).
outDirstringBuild output directory.
baselineDirstringWhere --save-baseline writes and --baseline / compare read.
runtimestring | string[]Shorthand runtime(s); see runOptions for full control.
verbosebooleanPrint all estimates by default.
deterministicbooleanEnable deterministic mode.
settingsobjectEngine tunables (below).
renderobjectVerdict thresholds (below).
buildOptionsobjectCompiler options (below).
profileobjectProfiler defaults (below).
runOptionsobjectRuntime command(s) (below).
modesobjectNamed overlays applied with --mode.

settings

Engine tunables — every field maps to a Settings property and a run CLI flag.

FieldDefaultBound
warmupTime3000≥ 0
warmupMinTime100≥ 0
warmupTolerance0.02≥ 0
measurementTime3000≥ 1
sampleSize0 (auto)≥ 10 when set
numResamples100000≥ 1
samplingModeautoauto | linear | flat
confidenceLevel0.95(0, 1)

sampleSize: 0 auto-sizes from warmup to ~10 ms/sample, clamped to [10, 500]. See Statistics & Output.

render

FieldDefaultMeaning
significanceLevel0.05p-value below which a change counts as significant.
noiseThreshold0.01Changes whose CI lies within ±this read as "no change".

buildOptions

FieldDefaultMeaning
optimizetrueCompile with optimizations.
debugfalseKeep debug info / the name section.
args[]Extra asc arguments (e.g. ["--transform", "json-as/transform"]).

profile

FieldDefaultMeaning
top10Rows per bench.
allfalseInclude internal rows.
iters10Iterations per bench (--time).
minInstrs4Skip wrapping functions under this many static instructions (--time).

runOptions

For more than the top-level runtime shorthand, use runOptions.runtime with a {cmd, name} object or a list:

json
{
  "runOptions": {
    "runtime": [
      "node",
      "wasmtime",
      { "cmd": "wazero run <env:-env> <file>", "name": "wazero" }
    ]
  }
}
  • <file> → the bench wasm path (appended last if omitted).
  • <env:PREFIX> → expands AS_BENCH_TUNE_* settings as runtime env flags; a trailing = fuses (<env:--env=>--env=K=V).

A list runs every bench under each runtime, rendered as a comparison table.

Modes

modes holds named partial configs applied with --mode <name>. Objects merge one level deep; scalars and arrays replace. A missing mode name errors with the list of available modes.

json
{
  "modes": {
    "full": { "settings": { "warmupTime": 3000, "measurementTime": 5000 } },
    "wasmtime": { "runtime": "wasmtime" }
  }
}