benchbudget

command
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL