performant-go
Installation
SKILL.md
Performant Go Skill
Goal
Harnessing Go's concurrency primitives and runtime efficiency to build systems capable of handling millions of requests with minimal memory overhead.
Capabilities
1. Concurrency & Parallelism
- Goroutine Leak Prevention: Always ensure goroutines have a well-defined lifecycle and termination signal (using
context.Context). - Channel Optimization: Use buffered channels where appropriate to prevent blocking. Prefer
selectfor non-blocking communication. - Sync.Pool: Implement
sync.Poolto reuse objects (like buffers or structs) and reduce Garbage Collector (GC) pressure.
2. Memory & Layout
- Memory Alignment: Structure fields in structs from largest to smallest to minimize padding and reduce memory footprint.
- Allocation Minimization: Use pointers to avoid copying large structs, but be mindful of "escape analysis" pushing objects to the heap.
- Pre-allocation: Always pre-allocate slices and maps using
make([]T, 0, capacity)when the target size is known.