Spyke

Replies

python

Comment on

Yes, a test only checks what you tell it. That was the whole argument, not a contradiction of it....

Reply in thread

Fair question, so straight answer: the goal is a fail-on-regression gate in CI. The posts are about the threshold problem, since a gate only means as much as the number you feed it.

The concrete version: decide what percentage of slowdown you'll accept, compare the PR run against a baseline branch, and fail the job when a change exceeds that number. Everything else was about how to pick a percentage that isn't a guess.

python

Comment on

Yes, a test only checks what you tell it. That was the whole argument, not a contradiction of it....

Reply in thread

Not sure what part read as slop, so I'll take it at face value: if the complaint is AI-generated filler, fair. Generic performance advice usually is.

The concrete version of the point, no filler: a benchmark gate in CI is only as good as the threshold you feed it. Pick a percentage by measuring your own run to run spread first. Run the same commit five times, look at the gap between fastest and slowest, and set your fail-on-regression number above that noise floor. A threshold inside the noise fails randomly. One way outside it lets real slowdowns through.

That's the whole trick. Measure the wobble, then gate on it.

python

Comment on

Yes, a test only checks what you tell it. That was the whole argument, not a contradiction of it....

Reply in thread

"Clean code means you don't need performance testing" is the part I'd push back on. Slowdowns aren't only structural. An innocent-looking change to a cache TTL, a query plan flip after an ORM update, or a dependency bump can regress throughput with zero code smells. Nothing about loops within loops warns you, it just ships slower. So the practical split: load testing in pre-production tells you whether the system meets its numbers today. A benchmark gate in CI tells you that PR didn't quietly make things 8% worse. Those answer different questions, and you want both. Agreed that unit tests are the wrong tool here, and agreed the simulation should weight operations close to real world splits. The piece I'd add is that the benchmark runs you're already doing for the gate become your trend line over time, so you're not starting cold when someone asks why release 4.2 feels slower than 4.1.

python

Comment on

A harmful change can exceed your allowed performance percentage and slip straight into main — unl...

Reply in thread

Ha, fair. Since you're here, a practical tip for benchmarks in CI.

Get your runs emitting machine readable output. pytest-benchmark can write JSON, go test takes -bench -benchmem -json, criterion takes --message-format=json, and Google Benchmark exports JSON. Parseable numbers are what make comparison against a baseline branch possible.

From there, set an allowed regression percentage per project and fail the build when a change crosses it. A non zero exit is the part that stops a harmful change before it merges.

You reached the end