golang.org/x/exp@v0.0.0-20240506185415-9bf2ced13842/slog/benchmarks/Makefile (about)

     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  
     7  count = 10
     8  
     9  default: compare-zap compare-zerolog
    10  
    11  compare-%: %_benchmarks/out.bench slog.bench
    12  	benchstat -ignore pkg $^
    13  
    14  slog.bench: *.go ../*.go ../../go.mod
    15  	go test -run NONE -bench . -count $(count) > $@
    16  
    17  slog-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