golang-performance

Identify and resolve performance bottlenecks in Go code using pprof and benchstat.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pprof, benchstat, go, golangci-lint, git, curl, fgprof, perf, websearch, askuserquestion, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill equips developers with the methodology and tools to identify and address performance bottlenecks in Go code.

Core Features & Use Cases

  • Performance Profiling: Utilize tools like pprof, fgprof, and benchstat to pinpoint and diagnose performance issues.
  • Optimization Techniques: Apply various techniques such as memory reduction, CPU efficiency, and algorithmic optimizations.
  • Use Case: When profiling or benchmarking Go code reveals a bottleneck, this Skill provides the necessary patterns and best practices to optimize it.

Quick Start

Use the golang-performance skill to optimize the CPU-bound function 'ProcessRecords' in your Go application.

Frequently Asked Questions about golang-performance

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

FAQPage Schema
How do I identify and resolve performance bottlenecks in Go code?

To resolve Go performance bottlenecks, apply optimization patterns like allocation reduction, memory layout improvement, and garbage collection tuning. Use profiling tools to pinpoint issues before optimizing hot paths for maximum CPU efficiency.

How do I profile a Golang application to find CPU and memory issues?

Profile a Golang application using pprof and fgprof to pinpoint CPU-bound functions and memory allocation issues. These tools diagnose performance bottlenecks by visualizing call graphs and allocation traces during runtime execution.

What is the best way to reduce memory allocations in Go for high-throughput applications?

The best way to reduce memory allocations in Go involves applying pooling, caching, and memory layout optimization patterns. These techniques minimize garbage collection pressure and significantly improve hot-path performance in high-throughput applications.

Can I use benchstat to compare Go benchmark results before and after optimization?

Yes, benchstat compares Go benchmark results to validate optimization efforts. By running benchmarks before and after applying techniques like allocation reduction or algorithmic improvements, you statistically confirm performance gains and prevent regressions.

When do I need to tune garbage collection in my Golang performance optimization workflow?

Tune garbage collection in your Golang optimization workflow when profiling reveals excessive GC pauses or high allocation rates on hot paths. Adjusting GC parameters reduces memory management overhead and improves overall CPU efficiency.

Does this Golang optimization approach work for both CPU-bound and memory-bound bottlenecks?

Yes, this optimization approach addresses both CPU-bound and memory-bound bottlenecks. It applies targeted patterns for CPU efficiency, allocation reduction, and memory layout tuning, ensuring comprehensive Golang performance improvements across different workload types.