go-performance
SKILL.md
Go Performance
Expert guidance for writing efficient, high-performance Go code.
Quick Reference
| Concern | Solution | Impact |
|---|---|---|
| String concatenation in loops | strings.Builder | O(n) vs O(n²) |
| Repeated allocations | sync.Pool | Reduces GC pressure |
| Large byte slice to string conversion | unsafe package (carefully) | Avoids allocation |
| I/O operations | bufio.Scanner/buffered writers | Reduces syscalls |
| Defer in tight loops | Move defer outside function | Prevents memory buildup |
| Premature optimization | Don't do it | Measure first |