golang-performance

Diagnose Go performance bottlenecks using pprof and fgprof profiling signals.

Updated May 28, 2026
One-click install
npx skills add https://github.com/vanstinator/semantic-search --skill golang-performance-vanstinator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: golang-performance
Source: https://github.com/vanstinator/semantic-search/tree/main/.agents/skills/golang-performance
Command: npx skills add https://github.com/vanstinator/semantic-search --skill golang-performance-vanstinator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It reduces Go service latency, CPU usage, and GC overhead by guiding you to the correct optimization once profiling proves where the real bottleneck lives.

Core Features & Use Cases

  • Profiling-first diagnostics: Triage on-CPU vs off-CPU issues using pprof, fgprof, tracing, and related signals before proposing changes.
  • Allocation, CPU, and memory layout playbooks: Target high-allocation hotspots, hot-path CPU inefficiencies, cache locality problems, GC pressure, and struct/slice retention bugs.
  • Iterative benchmark discipline: Define metrics, create atomic benchmarks, apply one optimization at a time, and confirm improvements with benchstat.

Quick Start

Ask the skill to review your hottest Go function for a confirmed bottleneck and propose one profiling-validated change with a baseline benchmark plan.

Frequently Asked Questions about golang-performance

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

FAQPage Schema
How do I reduce high allocations in my Golang hot path?

To reduce allocations in your Golang hot path, use profiling to identify the exact source, then apply allocation reduction patterns like sync.Pool, backing-array pre-allocation, or avoiding retention traps.

What's the best way to profile Go CPU and memory performance?

The best way to profile Go performance is a profiling-first workflow using pprof, fgprof, and tracing to triage on-CPU versus off-CPU issues before proposing any code changes.

Why does my Go service have high GC pressure and latency?

High GC pressure and latency in Go often stem from excessive heap allocations or struct/slice retention bugs; diagnosing requires mapping pprof signals to specific memory layout improvements.

How do I benchmark Go optimization changes accurately?

To benchmark Go optimizations accurately, follow an iterative metric, benchmark, diagnose, improve, and compare loop, applying one change at a time and confirming improvements with benchstat.

When should I use sync.Pool in Go for memory optimization?

Use sync.Pool in Go when profiling confirms allocation overhead in hot paths, but avoid misuse by ensuring proper resetting and understanding that it does not guarantee object retention during GC.

Can I improve cache locality by changing Go struct memory layout?

Improving cache locality by changing Go struct memory layout is effective when profiling reveals hot-path CPU inefficiencies, allowing you to reorder fields and eliminate unnecessary padding for better performance.