
Go Performance
Performance patterns for Go hot paths, covering conversions, allocation, string building, and benchmarking.
- CCM score
- 63 of 100
- skills.sh installs
- 1.4K
- GitHub stars
- 197
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers strconv over fmt, repeated byte conversions, container capacity hints, pass-by-value, and string concatenation strategy
- Includes
scripts/bench-compare.shfor comparing benchmark runs and saving baselines, plus references on benchstat, pprof, and string optimization - Enforces measuring before and after each change, keeping only optimizations that show a measurable improvement
- Designed for targeted tuning of hot paths in Go code, with concurrency patterns handled by go-concurrency
Install
$ npx -y skills add cxuu/golang-skills --skill go-performance -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Go Performance Patterns
Resource Routing
scripts/bench-compare.sh- Run when comparing benchmark results, saving baselines, or producing JSON benchmark metadata.references/BENCHMARKS.md- Read when writing benchmarks, using benchstat, or profiling with pprof.references/STRING-OPTIMIZATION.md- Read when optimizing string conversion, concatenation, or byte/string boundaries.
Performance-specific guidelines apply only to the hot path. Don't prematurely optimize—focus these patterns where they matter most.
Prefer strconv over fmt
When converting primitives to/from strings, strconv is faster than fmt:
s := strconv.Itoa(rand.Int()) // ~2x faster than fmt.Sprint()
| Approach | Speed | Allocations |
|---|---|---|
fmt.Sprint | 143 ns/op | 2 allocs/op |
strconv.Itoa | 64.2 ns/op | 1 allocs/op |
Avoid Repeated String-to-Byte Conversions
Convert a fixed string to []byte once outside the loop:
data := []byte("Hello world")
for b.Loop() { // Go 1.24+; use b.N loops only for older Go
w.Write(data) // ~7x faster than []byte("...") each iteration
}
Details
- Repository
- github.com/cxuu/golang-skills
- Categories
- Go, Debugging
- First seen
- May 16, 2026
More from cxuu/golang-skills
All 20- Go Naming1.3K
- Go Defensive1.3K
- Go Packages1.3K
- Go Functional Options1.3K
- Go Data Structures1.3K
- Go Control Flow1.3K
- Go Logging1.1K
- Go Generics1.1K
- Go Functions1.1K
- Go Declarations1.1K
- Go Code Review1.8K
- Go Testing1.5K
- Go Error Handling1.4K
- Go Concurrency1.4K
- Go Interfaces1.4K
- Go Linting1.4K
- Go Style Core1.4K
- Go Documentation1.4K
- Go Context1.4K
Similar to Go Performance
More Go
golang-benchmarkSkillsamber/cc-skills-golang41.9K installsGo benchmarking workflow covering writing, running, profiling, and statistically comparing benchmarks with pprof and benchstat.
golang-performanceSkillsamber/cc-skills-golang44.7K installsGo performance patterns for allocation reduction, CPU efficiency, GC tuning, pooling, and caching, applied per bottleneck.
golang-proSkillsickn33/agentic-awesome-skills455 installsExpert Go 1.21+ guidance for concurrency, performance tuning, and production-ready microservices with testing and profiling.
go-testingSkillcxuu/golang-skills1.5K installsGo test-writing guide that covers table-driven tests, subtests, helpers, and cmp.Diff assertions, with clear failure-message rules.
go-code-reviewSkillcxuu/golang-skills1.8K installsGo code review checklist covering formatting, errors, naming, concurrency, interfaces, and security checks with tooling.
performance-optimizerPlugindavila7/claude-code-templates24.2K starsPerformance optimization suite with profiling, bundle analysis, and speed improvement tools