go-performance-best-practices

Identify Go performance improvement patterns and profiling targets for optimization.

2|1|Updated Jan 17, 2026
One-click install
npx skills add https://github.com/mcart13/dev-skills --skill go-performance-best-practices
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-performance-best-practices
Source: https://github.com/mcart13/dev-skills/tree/main/skills/go-performance-best-practices
Command: npx skills add https://github.com/mcart13/dev-skills --skill go-performance-best-practices

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go performance optimization guidelines for profiling, allocation, GC tuning, concurrency, PGO, and I/O. This skill should be used when writing, reviewing, or optimizing Go code for performance. Triggers on tasks involving slow services, high latency, high memory usage, memory leaks, goroutine leaks, GC pressure, CPU profiling, pprof analysis, allocation reduction, sync.Pool, mutex contention, HTTP client tuning, Profile-Guided Optimization, GOMEMLIMIT tuning, Go 1.24 features, Swiss Tables, or any Go performance investigation.

Core Features & Use Cases

  • 41 rules across 8 categories, with real-world examples and patterns.
  • Profiling, benchmarking, allocation reduction, and GC tuning for Go services and CLI tools.
  • Example: identify hot paths in a latency-critical service and apply memory-safe optimizations like preallocation and buffered I/O.

Quick Start

Run a production-like benchmark, identify hot paths, and apply the guidelines to improve performance.

Frequently Asked Questions about go-performance-best-practices

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

FAQPage Schema
How do I reduce Go memory allocations and GC pressure in a high-throughput service?

Identify hot paths in latency-critical Go services by running production-like benchmarks and applying pprof profiling. Optimize allocation reduction and GC tuning using sync.Pool, preallocation, and GOMEMLIMIT to improve latency and throughput.

What is the best way to profile Go concurrency and mutex contention?

Profile Go concurrency and mutex contention using pprof CPU and blocking profiling to identify hot paths. Apply sync.Pool, context cancellation, and proper goroutine management to reduce lock contention and prevent goroutine leaks.

Can I use Profile-Guided Optimization to improve Go application performance?

Yes, you can use Profile-Guided Optimization (PGO) to improve Go application performance. PGO uses runtime profiling data to guide compiler optimizations, reducing latency and improving throughput across server and CLI Go applications.

How do I tune GOMEMLIMIT and garbage collection for Go services?

Tune GOMEMLIMIT and garbage collection for Go services by setting memory limits to match container quotas and adjusting GC parameters. This reduces GC pressure and prevents out-of-memory errors in memory-constrained environments.

Does this support optimizing buffered I/O and HTTP client tuning in Go?

Yes, this supports optimizing buffered I/O and HTTP client tuning in Go. It provides patterns for buffered I/O operations and HTTP client configurations to reduce latency and improve throughput in server and CLI applications.

Why should I use sync.Pool and preallocation for Go performance optimization?

Use sync.Pool and preallocation for Go performance optimization to reduce memory allocations and GC pressure. sync.Pool reuses objects, while preallocation avoids slice and map resizing, minimizing hot path latency in high-throughput services.