Unit testing your code’s performance, part 2: Testing speed
Summary
This article discusses turning performance benchmarks into tests to catch regressions early in CI by measuring CPU instruction counts and other signals. It covers the difference between benchmarks and tests, how to use tools like Valgrind/Cachegrind or real CPU counters, approaches to reduce noise, and practical Python examples, with notes on cross-CPU variability and build consistency.