Size-Specialized Memory Allocation
Summary
Go 1.27 introduces size-specialized memory allocation, accelerating allocations of 80 bytes or fewer and delivering up to 20-30% faster malloc calls and potential 1% gains for allocation-heavy workloads. The post explains how size classes and span classes drive specialized mallocgc variants, the trade-offs with instruction cache size, and compiler optimizations like inlining and constant-time clears to boost small allocations. It also covers benchmarking considerations, practical implications for developers, and how to enable or disable the feature.