performance-profiling

IvanTorresEdge's avatarfrom IvanTorresEdge

pprof usage and performance analysis. Use when profiling applications.

⭐0stars🔀0forks📁View on GitHub🕐Updated Jan 1, 2026

When & Why to Use This Skill

This Claude skill provides comprehensive guidance on using pprof for performance profiling and analysis. It empowers developers to identify CPU bottlenecks, detect memory leaks, and optimize application efficiency through detailed profiling commands, visualization techniques, and best practices for Go-based environments. By leveraging pprof, users can transform raw performance data into actionable insights to improve software scalability and responsiveness.

Use Cases

  • Identifying performance bottlenecks by analyzing CPU profiles and hot paths during high-load execution.
  • Detecting and resolving memory leaks in long-running services through heap profiling and goroutine analysis.
  • Visualizing complex application call graphs using flamegraphs and web-based interfaces for better architectural insights.
  • Implementing real-time production monitoring via HTTP pprof endpoints to diagnose live performance issues without downtime.
  • Benchmarking and comparing code changes to ensure optimizations yield measurable performance improvements.
nameperformance-profiling
descriptionpprof usage and performance analysis. Use when profiling applications.

Performance Profiling Skill

Using pprof for performance analysis.

When to Use

Use when identifying performance bottlenecks.

CPU Profiling

# During tests
go test -cpuprofile=cpu.out -bench=.

# Analyze
go tool pprof cpu.out

# Web interface
go tool pprof -http=:8080 cpu.out

Memory Profiling

# During tests
go test -memprofile=mem.out -bench=.

# Analyze
go tool pprof mem.out

HTTP Endpoint

import _ "net/http/pprof"

func main() {
    go func() {
        log.Println(http.ListenAndServe("localhost:6060", nil))
    }()
    // your code
}

Access profiles at:

  • http://localhost:6060/debug/pprof/
  • http://localhost:6060/debug/pprof/heap
  • http://localhost:6060/debug/pprof/goroutine

pprof Commands

(pprof) top      # Top functions
(pprof) list     # Source code view
(pprof) web      # Graph view
(pprof) pdf      # PDF output

Best Practices

  • Profile in production-like conditions
  • Profile before optimizing
  • Focus on hot paths
  • Check both CPU and memory
  • Use flamegraphs for visualization