z-go-performance

Installation
SKILL.md

Go Performance

Core discipline

Profile → hypothesize → change ONE thing → re-measure. Choose CPU, allocation rate, retained memory, or contention work from the measured bottleneck.

Before touching Go code, verify the bottleneck is in your process — if 90% of latency is a slow DB query or upstream API, reducing allocations won't help.

Use the project's existing CPU, wall-time and trace instrumentation. If adding fgprof, follow the pinned package's integration instructions; it is not a universal standalone -http launcher.

Iteration cycle

set -o pipefail
timeout 5m go test -run='^$' -bench=BenchmarkFoo -benchmem -count=10 -cpu=2 -timeout 2m -p 2 -parallel 2 ./pkg/... | tee bench-before.txt
# apply ONE change; these sequential runs are exploratory, not a causal A/B claim
timeout 5m go test -run='^$' -bench=BenchmarkFoo -benchmem -count=10 -cpu=2 -timeout 2m -p 2 -parallel 2 ./pkg/... | tee bench-after.txt
benchstat bench-before.txt bench-after.txt
Installs
15
First Seen
Jul 2, 2026