Documentation
¶
Overview ¶
benchbudget enforces performance budgets against go test -bench output.
Usage (Makefile pipe form — preferred):
go test -bench=. -benchmem -run=^$ ./... | go run ./internal/tools/benchbudget bench-budgets.txt
The tool reads benchmark output from stdin and a budget file from the first argument. It exits non-zero and prints a report of every benchmark that exceeds its budget. Benchmarks in the budget file that do not appear in the input emit a warning (not a failure) — the test binary may not have been run with -bench matching that name.
Budget file format (bench-budgets.txt at repo root):
# comment lines and blank lines are ignored BenchmarkName max_ns_per_op max_allocs_per_op
BenchmarkName must match the base name (no -N suffix). max_allocs_per_op of -1 means "unchecked" (useful during initial measurement).
Click to show internal directories.
Click to hide internal directories.