bench-regression
Skill458 starsChanged 2 months agoApache-2.0View on GitHub
Check a PR for performance regressions by comparing its benchmark run against its merge-base on next. Use when a dev asks "did my PR regress anything?" or wants to vet benchmark impact before merge.
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
Default to HEAD (or the ref the user gives).
- Very specific: line 56
Always pass --baseline explicitly (the script auto-detects via gh if omitted, but be explicit).
- Distinctive: line 65
Read the JSON and keep a regression only if all hold:
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PR benchmark regression check
Compares a PR's benchmark run against its baseline (merge-base on next, optionally a window of
baseline runs) and reports only the regressions that (a) are statistically real and (b) plausibly
relate to what the PR changed. The data-pulling and diff math are done by ci3/bench_compare; your
job is to get a run, invoke the script, then filter the output with judgement.
How benchmark data is stored (context)
Each CI benchmark run uploads a single bench-out/bench.json (a flat array of {name, unit, value},
customSmallerIsBetter — higher = worse) to the build-cache, keyed by the commit's git tree hash
(bench-<treehash>.tar.gz, ~40 KB). A PR only produces one on an uploadable run: labels
ci-full-no-test-cache, ci-full, or a merge-queue run. ci3/bench_compare pulls these per-run
blobs — never the multi-MB per-branch data.js graph history.
Steps
1. Get a benchmark run for the PR
- Default to
HEAD(or the ref the user gives). Try step 2 directly —ci3/bench_comparefails clearly if the commit has no bench data. - If there's no run and the user is fine using the last one: walk back the branch for the most
recent benched commit —
for c in $(git rev-list -n 30 HEAD); do ci3/bench_compare "$c" >/dev/null 2>&1 && echo "$c" && break; done— and use that commit. - If a fresh run is needed: tell the user to add the
ci-full-no-test-cachelabel to the PR (that triggers x-bench on a dedicated metal box and uploads) and to re-run this once CI finishes. Do not block waiting unless asked.
2. Determine the baseline branch — do NOT assume next
The comparison is merge-base(PR, baseline), so the baseline MUST be the PR's actual target branch.
A PR onto v5-next or a merge-train/* branch compared against next would report the entire
branch-vs-branch perf delta as bogus regressions. Get it from the PR itself:
gh pr view <pr-or-branch> --json baseRefName -q .baseRefName # e.g. next, v5-next, merge-train/spartan
git fetch origin <baseRefName> # ensure origin/<baseRefName> is current(You do NOT need to worry about cross-branch data mixups: the bench cache is content-addressed by git
tree hash, so next, v5-next, etc. already occupy different keys — a next commit's tree is only ever
benched by next-content. The only thing you control, and must get right, is which branch's lineage
you merge-base against.)
3. Run the comparison
ci3/bench_compare <pr-commit> --baseline origin/<baseRefName> --window 5 --out /tmp/bench-report.json- Always pass
--baselineexplicitly (the script auto-detects viaghif omitted, but be explicit). It printsbaseline = …to stderr — confirm it matches the PR's target before trusting the numbers. --window 5averages the merge-base + 4 preceding baseline runs, yieldingstddevandzper bench — essential for separating real regressions from flaky benches. Use--window 1if history is sparse.- JSON on
--outis{ meta, benches:[{name,unit,pr,baseline,n,pct,stddev,z,status}] }, sorted bypctdesc. Human summary on stderr.
4. Filter to what matters (your judgement)
Read the JSON and keep a regression only if all hold:
- Statistically real:
z >= ~4(the PR value is ≥4 baseline-stddevs above the mean). A largepctwith small/absentzis baseline noise — a flaky bench (e.g.p2p/BatchTxRequester/.../durationhitting a 30 s timeout,pctin the thousands) — ignore it. When window is 1 (noz), fall back to requiring a largepctAND a meaningful absolute magnitude. - Material magnitude: skip tiny absolutes (e.g.
0.01 ms -> 0.02 ms= +100% but noise). - Plausibly caused by the PR: map the bench
nameprefix to the PR's changed areas. Get the diff withgit diff --name-only $(git merge-base HEAD origin/next)..HEAD | cut -d/ -f1-2 | sort -u, then keep benches whose names start with a touched area (yarn-project/simulator,barretenberg/cpp,avm-transpiler, …) and treat far-away regressions (a TS-only PR moving a C++ proving bench) as drift/noise, not this PR.
5. Report
List the surviving regressions with baseline -> pr unit, pct, and z, grouped by area, and give a
one-line verdict (clean / N real regressions in <area>). Note anything you filtered out and why, so
the dev can override your judgement.
Notes
- Baseline is
origin/nextby default;git fetchit first if stale (ci3/bench_compareerrors if the ref is missing). - Requires
jq,python3, and read access to the build-cache (the publicbuild-cache.aztec-labs.comendpoint needs no creds; the in-VPC S3 path is a fallback). - To author or wire up new benchmarks, see the
adding-benchmarksskill; this skill only checks them.
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- pytorch/helion★ 977same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository22 other files it gives its agents.
- avm-transpiler/CLAUDE.mdCLAUDE.md
- barretenberg/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- docs/CLAUDE.mdCLAUDE.md
- docs/llms.txtllms.txt
- acir-formal-proofsSkill
- adding-benchmarksSkill
- capture-app-flowSkill
- chonk-inputsSkill
- ci-logsSkill
- create-issueSkill
- cycleSkill
- fixSkill
- genesis-constantsSkill
- merge-train-infraSkill
- merge-trainsSkill
- noir-sync-updateSkill
- prep-cycleSkill
- release-docsSkill
- release-network-docsSkill
- update-doc-referencesSkill
- updating-changelogSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

