benchcheck runs benchmarks on two different versions of a Go module and compares statistics across them, failing on performance regressions.
This tool aims at being Go specific and wildly simple, leveraging standard Go benchmarks + benchstat, composing them to provide just a few extra features:
- Given two module versions of a package, it automatically benchmarks and compares them
- Given a threshold on the delta of performance loss, the check fails (useful for CI's)
And that is it, no more, no less.
- git
- go
Just run:
go install github.com/madlambda/benchcheck/cmd/benchcheck@latest
For details just run:
benchcheck -help
By default all benchmarks are run with -benchmem, so you also have information on memory allocations.
Comparing performance between two versions of a Go module and just showing results on output (no check performed):
benchcheck cool.go.module v0.0.1 v0.0.2
Comparing performance between two versions of a Go module and failing on time regression:
benchcheck cool.go.module v0.0.1 v0.0.2 -time-delta +13.31%
Now doing the same but also checking for allocation regression:
benchcheck cool.go.module v0.0.1 v0.0.2 -alloc-delta +15% -allocs-delta +20%
You can also check if your code got faster and use the check to I don't know... Celebrate ? =P
benchcheck cool.go.module v0.0.1 v0.0.2 -time-delta -20%