Use when optimizing Go code, investigating slow performance, or writing performance-critical sections. Also use when a user mentions slow Go code, string…
Go Performance Patterns
Available Scripts
scripts/bench-compare.sh — Runs Go benchmarks N times with optional baseline comparison via benchstat. Supports saving results for future comparison. Run bash scripts/bench-compare.sh --help for options.
Performance-specific guidelines apply only to the hot path. Don't prematurely optimize—focus these patterns where they matter most.
Prefer strconv over fmt
When converting primitives to/from strings, strconv is faster than fmt:
s := strconv.Itoa(rand.Int()) // ~2x faster than fmt.Sprint()
related skills
semantically similar in the cross-vendor index
don't have the plugin yet? install it then click "run inline in claude" again.
+concrete benchmark tooling (bench-compare.sh) with baseline comparison via benchstat reduces friction for empirical validation
+correctly emphasizes measuring before optimizing, avoiding cargo-cult premature optimization
+specific micro-pattern example (strconv vs fmt) with quantified speedup claim
weaknesses
~incomplete - only fragments shown, no clear intent statement, inputs/outputs, decision tree, or outcome signals for the overall skill
~procedure quality sparse - no step-by-step path from 'code is slow' to 'optimized code', no guidance on profiling tools (pprof), memory allocation patterns, or goroutine tuning
~edge cases absent - no discussion of false positives in benchmarking (GC pauses, CPU scaling), micro-benchmark traps, or when strconv optimization doesn't matter