← ClaudeAtlas

golang-performancelisted

Go performance optimization techniques including profiling with pprof, memory optimization, concurrency patterns, and escape analysis.
aiskillstore/marketplace · ★ 329 · API & Backend · score 85
Install: claude install-skill aiskillstore/marketplace
# Golang Performance This skill provides guidance on optimizing Go application performance including profiling, memory management, concurrency optimization, and avoiding common performance pitfalls. ## When to Use This Skill - When profiling Go applications for CPU or memory issues - When optimizing memory allocations and reducing GC pressure - When implementing efficient concurrency patterns - When analyzing escape analysis results - When optimizing hot paths in production code ## Profiling with pprof ### Enable Profiling in HTTP Server ```go import ( "net/http" _ "net/http/pprof" ) func main() { // pprof endpoints available at /debug/pprof/ go func() { http.ListenAndServe("localhost:6060", nil) }() // Main application } ``` ### CPU Profiling ```bash # Collect 30-second CPU profile go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30 # Interactive commands (pprof) top10 # Top 10 functions by CPU (pprof) list FuncName # Show source with timing (pprof) web # Open flame graph in browser ``` ### Memory Profiling ```bash # Heap profile go tool pprof http://localhost:6060/debug/pprof/heap # Allocs profile (all allocations) go tool pprof http://localhost:6060/debug/pprof/allocs # Interactive commands (pprof) top10 -cum # Top by cumulative allocations (pprof) list FuncName # Show allocation sites ``` ### Programmatic Profiling ```go import ( "os" "runtime/pprof" ) func profileCPU() {