Skip to content

Reports and regression checks

A row baseline answers “Which implementation was faster in this run?” A saved baseline answers “Did this implementation get slower after my change?” Use the latter to check a pull request. The commands below use the program from Your first benchmark.

Run from the project root on the machine you will use for both revisions.

Terminal window
dart run microbench --thorough --verify --save=before.jsonl benchmark/join_benchmark.dart

The native runner uses AOT by default. --verify checks that the variants in a group produce the same answer. --save writes one JSON table per line with the measurements and samples needed for a later diff. Keep the baseline file available when switching revisions.

After applying the change, repeat the measurement with the same SDK, machine, target, inputs, and timing options. This command also writes a Markdown table for people reading the review.

Terminal window
dart run microbench --thorough --verify --save=after.jsonl --out=BENCHMARK.md benchmark/join_benchmark.dart
dart run microbench diff --threshold=5 before.jsonl after.jsonl

The diff compares time per run, regardless of the metric displayed in Markdown. A move from 20 to 22 microseconds is a 10% slowdown. With a 5% threshold it is a regression if the samples also show a significant difference. If either side has fewer than three samples, the diff uses the threshold alone. Exit code 1 signals a regression for a successfully read pair of reports. Keep the command output in the job log so a file or runner error can be diagnosed separately.

For a local check in one step, pass --baseline=before.jsonl to the candidate benchmark command. Saving both reports lets reviewers rerun the diff at another threshold without repeating the measurements.

The diff matches the table title, group, row, and column. Renaming a row produces a removal and an addition. Neither counts as a timing regression. Keep these names stable across revisions and review additions and removals alongside the verdict. If the meaning of an input changed, capture a fresh baseline for it.

Use a separate report path for each program and target. Each program writes its own --save and --out files. Passing one filename to directory discovery or several targets can overwrite earlier results. Several tables produced within one program can share its JSON Lines file.

Need Option
A pasteable table for a review --out=BENCHMARK.md
An HTML report --out=results.html
Measurements to compare later --save=results.jsonl
Console output on JS or Wasm --format=json or --format=md

File options require a native runtime. For web targets, capture the benchmark program’s output externally and keep runner headings and compiler messages out of machine-readable reports. To update a marked section of a README from a Markdown report, see Reports and tooling.

All guides · Working with comparison tables