Share a Criterion.rs benchmark report

Criterion does the statistics most benchmarking skips. It estimates the mean and the distribution, compares against a stored baseline, and tells you whether the change it measured is outside the noise — with plots that make an outlier obvious rather than something you have to infer from a single number.

cargo bench                       # → target/criterion/report/index.html

And then the report is a directory:

target/criterion/
├─ report/index.html          ← the entry point
├─ parse_json/
│  ├─ report/index.html       ← per-benchmark page
│  ├─ pdf.svg  violin.svg  regression.svg
│  └─ change/                 ← comparison against the previous baseline
└─ serialize/…

Sending index.html on its own gives the reader a page of dead links. Zipping it gives them a chore. Screenshotting the violin plot throws away the reason Criterion drew a violin plot.

Publish the folder

Drag target/criterion/report/ — or the whole target/criterion/ if you want the per-benchmark drilldowns — into the app:

  • index.html becomes the report body.
  • The per-benchmark pages and every generated SVG upload alongside it, and their relative references are rewritten to the uploaded copies, so clicking through to a specific benchmark works.
  • Scripts and inline SVG render inside a sandboxed iframe (allow-scripts, no allow-same-origin).

Or PATCH the entry file from a script:

cargo bench

curl -fsS -X PATCH "https://commareports.com/api/v1/reports/$REPORT_ID" \
  -H "Authorization: Bearer $COMMA_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --rawfile html target/criterion/report/index.html \
        --arg t "Criterion — parser, $(git rev-parse --short HEAD)" \
        '{title: $t, html: $html}')"

Publish the comparison, not just the run

The most valuable page Criterion generates is change/ — the comparison against the saved baseline, with the verdict and its confidence interval. Save a named baseline before a change and compare against it after:

git checkout main
cargo bench -- --save-baseline main

git checkout my-optimization
cargo bench -- --baseline main

The generated report now contains "Performance has improved" (or has not) with the interval attached. That is the artifact worth a URL in the pull request, because it is the one a reviewer can disagree with on the evidence.

From CI

Runner noise makes absolute numbers unreliable, but Criterion's own noise modelling means the verdict holds up better than a raw comparison would. PATCH one report id per suite and set a wide regression threshold:

cargo bench -- --baseline main --noise-threshold 0.05

One URL, a revision per run, and the revision list makes the runner's variance visible instead of leaving you to guess at it.

What review adds

  • Anchored threads on the benchmark under discussion — see commenting on HTML.
  • Revisions, so a claimed speedup is checkable later.
  • Access per report — private, team, domain-gated or named reviewers. See the sharing model.

Limits

  • Entry HTML: 5 MB. Assets: 25 MB per file, 250 MB and 500 files total. Criterion generates several SVGs per benchmark, so a suite with hundreds of benchmarks is the case that approaches the 500-file cap — publish report/ alone rather than all of target/criterion/ when it does.
  • 60 requests/minute per token.

Try it

Comma is free — unlimited reports, unlimited commenters, unlimited revision history.

Publish a benchmark →

Related