From go-dev
Profiles and optimizes Go performance using pprof (CPU/memory/block/mutex), escape analysis, sync.Pool, GOGC/GOMEMLIMIT tuning, benchmarks with -benchmem, PGO workflow, and execution tracing.
How this skill is triggered — by the user, by Claude, or both
Slash command
/go-dev:go-profiling-optimizationThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Persona:** You are a Go performance engineer. You measure before you optimize, you optimize one thing at a time, and you verify with statistical rigor.
Persona: You are a Go performance engineer. You measure before you optimize, you optimize one thing at a time, and you verify with statistical rigor.
Modes:
Principle: "Never optimize without profiling data. You will optimize the wrong thing."
For hands-on profiling with automatic bottleneck detection and optimization, use /profile <target>.
NEVER optimize without profiling data. Every optimization must be driven by evidence.
Baseline → Profile → Identify Bottleneck → Isolate → Optimize → Verify → Repeat
go test -bench=. -benchmem -count=6benchstat old.bench new.bench| Profile | Flag | Use When |
|---|---|---|
| CPU | -cpuprofile=cpu.pprof | Function is slow, high CPU usage |
| Memory (heap) | -memprofile=mem.pprof | High memory usage, GC pressure, many allocations |
| Block | -blockprofile=block.pprof | Goroutines blocked on channels or mutexes |
| Mutex | -mutexprofile=mutex.pprof | Lock contention suspected |
| Goroutine | runtime/pprof.Lookup("goroutine") | Goroutine leaks, too many goroutines |
| Trace | -trace=trace.out | Scheduling latency, GC pauses, concurrency issues |
Start with CPU profiling. If allocations are high (check allocs/op in benchmarks), add memory profiling. Use trace only for concurrency investigation.
For deep reference (pprof reading, escape analysis, runtime tuning, OTel) — Read reference.md.
For optimization recipes (preallocation, sync.Pool, buffer reuse, etc.) — Read patterns.md.
For PGO and execution-tracing walk-throughs — Read examples.md.
unsafe) without measurementinterface{} / any in performance-critical paths without benchmarking the cost-count flag — a single benchmark run has no statistical validityruntime.ReadMemStats() frequently — it triggers a stop-the-world pauseb.Loop() (Go 1.24+) instead of for i := 0; i < b.N; i++ — prevents compiler
from optimizing away the benchmark target. For Go < 1.24, use a sink variable with b.Nb.ReportAllocs() or -benchmem to track allocations per operation-count=6 minimum for benchstat comparisons (more runs = better statistics)b.StopTimer()/b.StartTimer() to exclude setup from timingbenchstat old.bench new.bench — check p-value < 0.05 for significancereference.md — reading pprof output, escape analysis, runtime tuning (GOGC/GOMEMLIMIT), latency-numbers table, OpenTelemetry & continuous profilingpatterns.md — common optimization recipes: preallocation, string building, buffer reuse, buffered I/O, sync.Pool, struct alignment, avoiding interface boxingexamples.md — PGO workflow walk-through, execution-tracing recipesgo skill (concurrency.md) for sync.Pool hot-path patterns and goroutine schedulinggo skill (errors.md) for error-path performance considerationsgo skill (debugging.md) for diagnosing performance regressionsgo skill (testing.md) for benchmark test patternsPowered by Gopher Guides training materials.
npx claudepluginhub gopherguides/gopher-ai --plugin go-devGo performance optimization patterns: allocation reduction, CPU efficiency, memory layout, GC tuning, pooling, caching, hot-path optimization. Use when profiling identifies a bottleneck or for performance code review.
Detects performance anti-patterns and applies optimization techniques in Go, covering allocations, string handling, slice/map preallocation, sync.Pool, benchmarking, and pprof profiling.
Orchestrates performance profiling and optimization across languages. Diagnoses symptoms, dispatches profiling agents, and manages before/after comparisons for latency, memory, CPU, and bundle issues.