Files
swift-nio-http2/Sources
Stefana-Ioana Dranca c6afe04165 Avoid CoW while processing the next state when HTTP2FrameDecoder decodes (#438)
Motivation:

CoWs appear when switching over the current state of the parser and holding it while also modifying it - inside `processNExtState()`. Following `append(bytes: ByteBuffer)`'s pattern, we should use a function that sets the state to an intermediary one with no associated data, before making the transformations.

Modifications:
- created the `avoidParserCoW()` helper function for the throwing functions
- used it in the switch cases inside `processNextState()`

Result:

CoW will be avoided when changing the state of the HTTP2FrameDecoder when decoding, so we won't have unnecessary heap allocations.
2024-04-17 09:08:28 +01:00
..