go-performance

Apply Go performance patterns to optimize hot-path code and reduce allocations.

139|17|Updated Jan 27, 2026
One-click install
npx skills add https://github.com/cxuu/golang-skills --skill go-performance-cxuu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-performance
Source: https://github.com/cxuu/golang-skills/tree/main/skills/go-performance
Command: npx skills add https://github.com/cxuu/golang-skills --skill go-performance-cxuu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go performance patterns help developers optimize hot-path code in Go, reducing allocations and improving throughput by applying proven techniques from reputable style guidelines.

Core Features & Use Cases

  • Efficient string handling: prefer strconv over fmt when converting primitives to strings, avoid repeated conversions, and minimize allocations.
  • Container capacity hints: pre-size maps and slices to reduce reallocations and improve cache behavior.
  • Benchmark-driven decisions: use benchmarks to guide optimizations and avoid premature improvements in non-critical paths.
  • Real-world example: optimize a loop that formats numbers and writes to a buffer to reduce allocations and overhead.

Quick Start

Identify a hot path in your Go code and apply a concrete performance pattern to achieve a measurable speedup.

Frequently Asked Questions about go-performance

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

FAQPage Schema
How do I reduce allocations in Go string handling?

To reduce allocations in Go string handling, prefer strconv over fmt when converting primitives to strings and avoid repeated conversions. This minimizes memory overhead and improves throughput on hot-path code.

What is the best way to pre-size Go maps and slices?

Pre-sizing Go maps and slices involves providing capacity hints at initialization. This reduces reallocations and improves cache behavior, leading to measurable performance improvements in production Go services.

How do I benchmark Go code to validate performance improvements?

You validate Go performance improvements by writing benchmarks to measure allocation and throughput changes. Benchmark-driven decisions help avoid premature optimizations in non-critical paths and ensure speedups in hot-path code.

Do I need knowledge of the Go runtime to optimize hot-path code?

Yes, optimizing hot-path code requires knowledge of the Go runtime, memory allocations, and benchmarking. Understanding these mechanisms is necessary to apply performance patterns and reduce allocations effectively.

When should I avoid premature optimization in Go services?

You should avoid premature optimization in non-critical paths of Go services. Use benchmarks to identify hot-path code first, ensuring you apply performance patterns only where measurable speedup is needed.