go-performance

Identify Go performance bottlenecks in string handling, conversions, and allocations.

Updated Apr 16, 2026
One-click install
npx skills add https://github.com/HadiCherkaoui/opencode-config --skill go-performance-hadicherkaoui
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-performance
Source: https://github.com/HadiCherkaoui/opencode-config/tree/main/skills/golang/go-performance
Command: npx skills add https://github.com/HadiCherkaoui/opencode-config --skill go-performance-hadicherkaoui

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Go performance patterns help developers optimize hot paths in Go code by using proven techniques to reduce allocations, speed up string handling, and improve memory efficiency.

Core Features & Use Cases

  • Efficient string handling with strconv instead of fmt for numeric conversions in hot paths.
  • Avoid repeated string-to-byte conversions by reusing pre-allocated buffers and types.
  • Encourage preallocation of slices and maps to reduce allocations in loops and batch processing.
  • Use case: optimize a high-volume data processing service that parses and formats logs and metrics.

Quick Start

Run a quick review to replace inefficient conversions in a hot path with strconv and preallocate slices to minimize allocations.

Frequently Asked Questions about go-performance

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

FAQPage Schema
How do I optimize Go performance in high-volume data processing hot paths?

To optimize Go performance in hot paths, replace fmt conversions with strconv, preallocate slices and maps, and reuse pre-allocated buffers to minimize memory allocations and reduce latency.

Why is strconv faster than fmt for numeric conversions in Go?

Strconv is faster than fmt for numeric conversions in Go because it avoids the reflection and interface allocation overhead required by fmt, directly handling types to optimize hot-path performance.

What is the best way to reduce memory allocation in Go loops?

The best way to reduce memory allocation in Go loops is to preallocate slices and maps to their expected capacity before iterating, preventing repeated underlying array reallocations and memory churn.

When should I avoid Go performance optimization patterns?

You should avoid Go performance optimization patterns when a guardrail identifies premature optimization, meaning the code is not a hot path, benchmarks show negligible latency, or readability outweighs marginal gains.

How do I stop repeated string-to-byte conversions in Go services?

Stop repeated string-to-byte conversions in Go services by reusing pre-allocated byte buffers instead of creating new allocations on each iteration, significantly improving memory efficiency in hot paths.