Files
swift-nio-http2/Sources/NIOHTTP2/Frame Buffers
George Barnett d22e5ea2e5 Avoid allocation in outbound frame buffer (#385)
Motivation:

CiruclarBuffer always allocates on init as it never has a zero capacity.
It is implemented in such a way that changing this is not trivial. The
compound outbound buffer creates a marked circular buffer
unconditionally on each call but only uses it if there are streams to
drop.

Modifications:

Add a static empty marked circular buffer to the compound outbound
buffer and rely on CoW semantics to avoid the allocation for each call
in cases where there are no frames to drop.

Result:

Fewer allocations.
2023-04-06 11:30:14 +01:00
..