Go performance
Go performance workflow for benchmarking, profiling, pprof, trace, allocation analysis, CPU/memory/latency/throughput optimization, and before/after measurement in greenfield modules.From its SKILL.md
npx -y skills add nyquistwilder/personal-pi --skill go-performanceAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.0 KB, 393 tokens by cl100k_base, as published. Nobody here has run it
Go Performance
Rule
Measure before optimizing and preserve correctness. Prefer algorithmic improvements, allocation-aware data flow, and bounded concurrency over clever micro-optimizations.
Hard Stops
Stop when:
- No target metric or representative workload exists.
- Correctness tests do not protect the behavior being optimized.
- The optimization requires public API changes, semantics changes,
unsafe, cgo, or unreadable code without approval. - Benchmark results are too noisy to support the conclusion.
Defaults
- Use
testing.Bbenchmarks for package-level performance. - Use
benchstatto compare before/after results when available. - Use pprof for CPU/heap/mutex/block profiles and
go test -traceor runtime trace for scheduler/concurrency issues. - Inspect allocations with
go test -bench ... -benchmemand escape analysis withgo test -gcflags=-mwhen useful. - Optimize one thing at a time and keep benchmark inputs realistic.
Workflow
- Define metric: latency, throughput, allocations, CPU, memory, binary size, startup, or tail behavior.
- Create or run a representative benchmark and capture baseline.
- Profile to identify the bottleneck instead of guessing.
- Make one focused change.
- Rerun benchmarks multiple times and compare with
benchstatwhen possible. - Run correctness tests, race tests for concurrency changes, and
just check.
Antipatterns
- Optimizing code outside the measured hot path.
- Trading clear code for tiny unproven wins.
- Unbounded goroutines or caches to improve happy-path throughput.
- Pooling small objects without allocation evidence.
- Using
unsafefor avoidable conversions or premature zero-copy tricks.
Completion
Report baseline, profile evidence, change made, before/after results, benchmark commands, correctness validation, and tradeoffs.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.