...
1# Run and compare benchmarks.
2# This requires a version of benchstat that supports
3# the -ignore flag. The flag was added on or before 13 January 2023,
4# so a compatible version can be obtained by running
5# go install golang.org/x/perf/cmd/benchstat@latest
6
7count = 10
8
9default: compare-zap compare-zerolog
10
11compare-%: %_benchmarks/out.bench slog.bench
12 benchstat -ignore pkg $^
13
14slog.bench: *.go ../*.go ../../go.mod
15 go test -run NONE -bench . -count $(count) > $@
16
17slog-nopc.bench: *.go ../*.go ../../go.mod
18 go test -nopc -run NONE -bench . -count $(count) > $@
19
20%_benchmarks/out.bench: %_benchmarks/*.go %_benchmarks/go.mod
21 go test -C $*_benchmarks -bench . -count $(count) > $@
22
23# Don't delete the out.bench files after a comparison.
24.PRECIOUS: %_benchmarks/out.bench
25
View as plain text