How it works
CodSpeed tags every flamegraph frame that belongs to an allocator, covering the standard allocation functions, common allocators such asjemalloc and
language-runtime allocators. With allocation exclusion enabled, CodSpeed sums
the time spent in those frames, including everything they call, and subtracts it
from the reported benchmark value.
The flamegraph still shows the allocator frames, marked with an Allocator tag
in the tooltip. Only the reported benchmark value changes.
When to use it
- Exclude allocations when allocator noise dominates a micro-benchmark and you are optimizing your own code.
- Keep allocations included when the allocator itself is what you are measuring or optimizing.
Enable it
Pass the flag to the CodSpeed CLI:.github/workflows/codspeed.yml
Next Steps
Reducing Variance
Techniques to make your benchmarks more stable across runs.
Unexpected Regressions
Understand why benchmarks can regress without code changes.