golang-performance

Profile Go applications with pprof to identify CPU, memory, and goroutine bottlenecks.

Updated Mar 3, 2026
One-click install
npx skills add https://github.com/jacexh/skills --skill golang-performance-jacexh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-performance
Source: https://github.com/jacexh/skills/tree/main/skills/golang-performance
Command: npx skills add https://github.com/jacexh/skills --skill golang-performance-jacexh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Identifies and diagnoses CPU, memory, and concurrency bottlenecks in Go applications so engineers can make targeted optimizations with measurable improvements in latency, throughput, and memory usage.

Core Features & Use Cases

  • Detailed CPU profiling workflows using pprof for hotspot and call-graph analysis.
  • Heap and allocation profiling to detect leaks, reduce allocations, and lower memory pressure.
  • Benchmarking patterns and sub-benchmarks using go test and benchstat to compare implementations.
  • Goroutine leak detection, production-safe pprof HTTP endpoints, and GC tuning guidance for GOGC and GOMEMLIMIT.
  • Practical optimizations: pre-allocating slices, using strings.Builder, escape analysis, buffer pooling, and avoiding defer in hot paths.

Quick Start

Run a 30 second CPU profile against your Go service, save the profile, and open it in the pprof web UI for immediate hotspot analysis.

Frequently Asked Questions about golang-performance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I profile a Go application to find CPU bottlenecks?

CPU profiling identifies execution bottlenecks by collecting call-graph data. You can run a 30-second CPU profile against your Go service, save the profile, and open it in the pprof web UI for immediate hotspot analysis.

What is the best way to detect goroutine leaks in Go services?

Goroutine leak detection identifies concurrency bottlenecks by analyzing running goroutines. This skill supports profiling Go services and test binaries to pinpoint goroutine leaks and reduce memory pressure.

How do I benchmark and compare Go code implementations?

Benchmarking compares implementations by measuring performance metrics. You can use go test benchmarking patterns and sub-benchmarks, then analyze the results with benchstat to compare different implementations.

When do I need to tune GOGC and GOMEMLIMIT for Go garbage collection?

GC tuning adjusts garbage collection behavior to lower memory pressure. You need to tune GOGC and GOMEMLIMIT when heap analysis reveals high allocation rates or when optimizing memory usage in production Go applications.

Can I use pprof with production Go HTTP endpoints?

Yes, production-safe pprof HTTP endpoints allow runtime profiling of live services. You can expose these endpoints to collect CPU, heap, and goroutine profiles from your Go applications without impacting production traffic.

Why does heap profiling help reduce memory allocations in Go?

Heap and allocation profiling detects memory leaks and reduces memory pressure. It guides practical optimizations like pre-allocating slices, using strings.Builder, and applying buffer pooling to minimize garbage collection overhead.