Go 1.25 compiler now automatically allocates small slice backing stores on the stack instead of heap, eliminating allocation overhead for variable-capacity slices below 32 bytes.
Summary
Reduces garbage collector pressure and eliminates startup-phase allocations in slice-building loops—critical for hot code paths where repeated small allocations compound latency and memory churn.
Why it matters
Reduces garbage collector pressure and eliminates startup-phase allocations in slice-building loops—critical for hot code paths where repeated small allocations compound latency and memory churn.
Implementation verdict
Replace manual capacity hints and conditional allocation patterns. Requires upgrading to Go 1.25+; no code changes needed for existing `make([]T, 0, n)` calls. Go 1.26 extends this to `append`-driven slice growth. Worth upgrading immediately if slice allocation appears in profiles.
Sources
Dev Signal
Get briefs like this in your inbox — free, every weekday.
100+ sources compressed into one 4-minute read. Ranked, cited, implementation-ready.