Machines that hold still
There are two ways to get a stable number, and you can use both. CPU simulation runs each benchmark once and counts what the CPU would do: instructions weighted by their real hardware cost, plus cache misses. With CodSpeed v5, adiv no longer counts the same as a mov. It runs on the
standard runners you already pay for, and the result is the same on every run.
It leaves out system calls, so it fits CPU-bound code like parsers and
serializers.
Macro Runners are dedicated bare-metal machines with isolated CPU cores and a
fixed clock. On the same four suites, their coefficient of variation was 0.56%.
At a 2% gate, the false-positive chance drops to 0.04%, about 1 in 2,500 runs.
The Ryzen 9 9950X runner keeps noise under 0.5%, so a 1.7% change stands out
with 99% confidence. The move is two lines in the workflow: point runs-on at
the runner label and run the command through CodSpeedHQ/action.
Building this yourself means buying or renting bare metal, pinning cores and
clocks, and keeping the image current. Then you’d measure the noise to know
which gate you can trust.
A baseline for every pull request
A number only means something next to the right baseline. On a pull request, the baseline is the latest commit on the base branch that has a CodSpeed run, compared against the merge commit. You run CodSpeed onpush to main and on
pull_request, and the history builds itself. A workflow_dispatch trigger
lets CodSpeed backtest older commits to fill in the first data points.
Two more details are handled for you. When a run skips benchmarks, the skipped
ones reuse results from the base run, so the history has no holes. And every
comparison diffs the environment: toolchain versions, linked libraries and CPU
flags. If the Rust toolchain moved from 1.95.0 to 1.96.1 between two runs, the
comparison says so next to the numbers.
A check that can block the merge
Each pull request gets a status check named “CodSpeed Performance Analysis”. Make it a required check and a regression above the threshold blocks the merge. The default threshold is 10%, and each benchmark can carry its own, from 0% to 50%. When a slowdown is intentional, an admin acknowledges it from the pull request and the check passes.The reason, next to the number
Every benchmark comes with a flamegraph, for CPU simulation, walltime and memory. On a regression, the differential flamegraph shows which functions got slower between the base and the pull request. The engineer who sees the red check also sees where the time went.Where your CI already runs
The same setup works on GitHub Actions, GitLab CI, Buildkite and CircleCI, and any other runner through the CodSpeed CLI. Benchmarks use each language’s own harness: criterion and divan in Rust,testing.B in Go, pytest-codspeed in
Python, vitest bench in Node.js, Google Benchmark in C++ and JMH in Java.
Your coding agent can read the results
The CodSpeed MCP server gives Claude Code, Cursor, Codex and other MCP clients your runs, comparisons and flamegraphs. An agent can ask why a benchmark got slower, read the flamegraph and propose the fix. Thecodspeed-optimize skill
runs that loop on its own: measure, read the hot spots, change the code, measure
again.