Golang performance optimization patterns and methodology - if X bottleneck, then apply Y. Covers allocation reduction, CPU efficiency, memory layout, GC tuning, pooling, caching, and hot-path optimization. Use when profiling or benchmarks have identified a bottleneck and you need the right optimization pattern to fix it. Also use when performing performance code review to suggest improvements or benchmarks that could help identify quick performance gains. Not for measurement methodology (see golang-benchmark skill) or debugging workflow (see golang-troubleshooting skill).
88
88%
Does it follow best practices?
Impact
84%
0.97xAverage score across 3 eval scenarios
Passed
No known issues
Iterative optimization workflow with benchmark documentation
Slice reuse pattern
100%
7%
riskTags declared outside loop
100%
0%
Direct indexing for results
33%
0%
Code comment: slice reuse why
100%
37%
Code comment: direct indexing why
12%
0%
Atomic benchmark
100%
100%
Benchmem and count comment
100%
100%
Baseline command in log
100%
100%
One change at a time
100%
100%
benchstat comparison command
100%
100%
perf commit format
100%
100%
Production Prometheus observability and GC tuning for containerized Go service
Prometheus client package
100%
100%
GOMEMLIMIT set
100%
83%
GC pause alert
90%
100%
Goroutine leak alert
100%
100%
Memory limit alert
100%
100%
GC frequency PromQL
90%
100%
Goroutine leak PromQL
100%
100%
CPU saturation PromQL
87%
100%
Allocation regression PromQL
62%
100%
Worst-case GC pause PromQL
87%
100%
Threshold explanations
100%
100%
High-throughput validator: compiled patterns, template cache, lookup table, singleflight
Regexp at package level
100%
100%
No per-call compilation
100%
100%
Lookup table for CategoryPriority
100%
100%
Template parsed once
100%
100%
singleflight for cache miss
57%
100%
No global mutex serialization
60%
100%
singleflight sf.Do pattern
0%
100%
summary.html template file
100%
100%
ContainsProhibited multi-pattern
100%
100%
91034cc
Table of Contents
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.