Benchmarks
The benchmark suite is a regression signal for Zero's goals: small artifacts, fast builds, predictable output, and low overhead.
Run it locally:
npm run benchThe report is written to:
.zero/bench/latest.jsonTrend artifacts are written to:
.zero/bench/trends/latest.json
.zero/bench/trends/summary.mdCases
The current cases include:
hello: minimal outputadd: arithmetic and a helper functionstructs: shape construction and direct field accessparams: multiple typed parameters and nested callsbuffers: fixed arrays, spans, copy/fill, and byte equalityparser: parser-like token metadata and direct predicate checkscodec:std.codecloops, varint length, and CRC-32parse: scanner-style digit parsingslices,arena,fallibility,branches: memory views, fixed-buffer allocation style, explicit fallible branching, and branch-heavy loopsmodule-package,rescue: package graph overhead and local rescue loweringfs-resource,mem-copy-fill,zero-hash: focused Zero cases for file-resource metadata, memory helpers, and deterministic byte payload processing
The Zero sources for these cases live under benchmarks/zero.
Host targets that do not support a direct executable runner for a case report it
as skipped with a reason instead of failing the whole benchmark run.
Metrics
buildMs: wall-clock time for the compiler commandrunMs: median wall-clock time across repeated executable runsrunMinMs: minimum wall-clock time across repeated executable runsrunRuns: raw per-run wall-clock timingsartifactBytes: output executable sizecompressedArtifactBytes: gzip-compressed executable sizepeakRssBytes: maximum resident set size when availableexpectedStdoutandoutputMatches: semantic checks that catch drift
Claims And Limits
Use these numbers narrowly:
- build time is represented by
buildMs - artifact size is represented by
artifactBytes - compressed size is represented by
compressedArtifactBytes - run time is represented by the per-case run metrics
Do not treat one local run as a definitive performance claim. Process startup, host load, and cache state all affect results.
Options
Change the repeat count:
ZERO_BENCH_RUNS=<n> npm run benchRun the sandbox backend explicitly:
ZERO_BENCH_MODE=sandbox npm run benchSandbox mode prepares an isolated environment and is useful for CI. Local mode is the default public workflow.