golang-performance

Diagnose Golang performance bottlenecks with pprof and benchstat benchmarks.

2.9k|191|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/samber/cc-skills-golang --skill golang-performance-samber
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: golang-performance
Source: https://github.com/samber/cc-skills-golang/tree/main/skills/golang-performance
Command: npx skills add https://github.com/samber/cc-skills-golang --skill golang-performance-samber

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

Go performance optimization is often stuck behind guesswork; this Skill provides a profiler-first approach to identify bottlenecks and apply measurable improvements.

Core Features & Use Cases

  • Profiling-guided patterns for memory allocations, CPU hot paths, and I/O bottlenecks.
  • Iterative optimization workflow: baseline benchmarks, diagnosis with pprof/benchstat, implement a single change, re-benchmark, and compare results.
  • Use cases include profiling a HTTP handler, a concurrent worker pool, or a data-processing pipeline to reduce latency and improve throughput.

Quick Start

Run a baseline benchmark on your hot path, profile it, and iteratively apply one optimization at a time.

Frequently Asked Questions about golang-performance

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

FAQPage Schema
How do I find and fix Golang performance bottlenecks in my application?▼

To find Golang performance bottlenecks, use a profiler-first workflow: establish baseline benchmarks, diagnose CPU and memory hot paths with pprof, apply a single code-level refactor, and re-benchmark with benchstat to verify measurable improvements.

What is the best way to optimize Go memory allocations and CPU usage?▼

The best way to optimize Go memory allocations and CPU usage is profiling-driven pattern application. Diagnose specific allocation hot paths and CPU bottlenecks using pprof, then iteratively refactor code and compare benchmark results to ensure latency reduction.

How do I benchmark Go code to prevent performance regressions?▼

To benchmark Go code and prevent regressions, run baseline benchmarks on your hot paths, implement a single optimization change, and use benchstat to compare results. This structured workflow provides measurable regression checks for HTTP handlers or worker pools.

Can I use pprof to profile concurrent worker pools and data-processing pipelines?▼

Yes, you can use pprof to profile concurrent worker pools and data-processing pipelines. This profiler-first approach diagnoses CPU, memory, and I/O bottlenecks to reduce latency and improve throughput across various Go project architectures.

Why does my Go application have high latency and how do I reduce it?▼

High latency in Go applications often stems from unidentified memory allocations or I/O bottlenecks. Reduce latency by profiling hot paths with pprof, applying targeted optimization patterns, and verifying throughput improvements through iterative benchmarking.

Do I need to run benchmarks before optimizing Go code?▼

Yes, you need to run baseline benchmarks before optimizing Go code. Establishing a baseline allows you to accurately diagnose bottlenecks with pprof, apply a single change, and compare new benchmark results with benchstat to confirm measurable improvements.