Repository navigation
Address recurring CodSpeed warnings - #10839
Conversation
Merging this PR will regress 7 benchmarks3 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
pytest-codspeed records Python frames only through the CPython perf trampoline, which exists from Python 3.12. The job used 3.11 from `.python-version`, so CodSpeed reported all 40 Python benchmarks as having no flamegraph on every pull request. The extension targets the stable ABI from 3.11, so it runs unchanged on 3.13. Claude-Session: https://claude.ai/code/session_01KF3pMFx7U5ngk8BzQQFS2W Signed-off-by: Claude <noreply@anthropic.com>
mimalloc returns freed memory to the OS 10 ms after a free. Under the CodSpeed simulation, benchmarks run many times slower, so the purge of one benchmark's memory can land in a later benchmark's single measured iteration. That iteration then spends its time in `madvise` calls and page faults, which the simulation leaves out, and CodSpeed reports it as dominated by system calls or as measuring no time. Under Valgrind, `MIMALLOC_PURGE_DELAY=-1` cut the `madvise` calls of the `filter_powerlaw` benchmarks from 23 to 1. Claude-Session: https://claude.ai/code/session_01KF3pMFx7U5ngk8BzQQFS2W Signed-off-by: Claude <noreply@anthropic.com>
Tracing the measured regions under callgrind showed where the remaining system calls and the empty measurement came from: - `ilike_contains` and `filter_run_end[len=4096_run=16_density=0.1]` paid for one-time process setup (the first regex compilation and the session id interner, which read the CPU quota from the file system). Both bench binaries now run the operation once in `main()`. - `zstd_compress_string` grew glibc's heap with `brk`. zstd allocates through glibc, which trims its heap after large frees. The simulation job now sets `MALLOC_TRIM_THRESHOLD_` and `MALLOC_TOP_PAD_`. - `filter_powerlaw_by_mostly_false[1000]` did under 1 µs of work, and about half of its measured iteration was mimalloc setting up a fresh page after the previous, larger case. The 1000-row size is gone from `filter_bool.rs`. The benchmarking guide gains a rule against leaving one-time setup to the first measured iteration. Claude-Session: https://claude.ai/code/session_01KF3pMFx7U5ngk8BzQQFS2W Signed-off-by: Claude <noreply@anthropic.com>
41576fd to
83d7d47
Compare
Summary
Every CodSpeed report carries the same warnings. This removes the ones with a cause in this repository: "no flamegraph", "unable to measure", and all of "dominated by system calls" except real file I/O.
Changes
brk. The simulation job now setsMIMALLOC_PURGE_DELAY=-1,MALLOC_TRIM_THRESHOLD_andMALLOC_TOP_PAD_. With the setup fixes below, this took the system-call warning from 15 benchmarks to 2 Python ones on this PR, and fixedbench_compare_primitive[(10000, 2)].ilike_containsandfilter_run_end[len=4096_run=16_density=0.1]paid for process-wide setup: the first regex compilation and the session id interner, which read the CPU quota from cgroup files. Both bench binaries now run the operation once inmain(), and the guide gains a rule against this mistake.filter_bool.rsdrops the 1000-row size. It did under 1 µs of work, and about half offilter_powerlaw_by_mostly_false[1000]'s iteration was mimalloc setting up a fresh page after the previous, larger case. CodSpeed reported no execution time for it.Not addressed: "Walltime results may be unreliable" and "Base and head ran on different runner types" come from running walltime on self-hosted machines instead of CodSpeed Macro Runners. Two Python scans still read a file inside the measured iteration, which is real I/O.
How the causes were found
The benchmarks were built with
--cfg codspeedand run undervalgrind --tool=callgrind --instr-atstart=no -v --trace-syscalls=yes. CodSpeed starts and stops callgrind instrumentation around each measured iteration, and-vlogs those switches, so the system calls between them are exactly the ones inside a measured iteration. With the changes, none of the measured iterations inlike,run_end_filter,filter_boolandsingle_encoding_throughput(116 in all) makes a system call.Checks run:
cargo clippy --locked -p vortex-arrayon the three changed benches (after rebasing onto #10703, which moved RunEnd intovortex-array) with-D warnings,cargo +nightly-2026-09-10 fmt --check,yamllint --strict,typos,git diff --check, and the callgrind traces above. Not run: the CodSpeed jobs (they run on this PR).https://claude.ai/code/session_01KF3pMFx7U5ngk8BzQQFS2W
Generated by Claude Code