mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
For small fixed-size allocations, we can use stack instead of heap. ### Motivation: Allocations are costly. Stack allocations are much cheaper than heap allocations. ### Modifications: Use `withUnsafeTemporaryAllocation(of:capacity:_:)` instead of allocating an `Array`. `withUnsafeTemporaryAllocation` allocates on the stack for up to 1000 bytes. ### Result: Better performance.