mirror of
https://github.com/apple/swift-nio-http2
synced 2026-11-27 05:04:23 +00:00
Motivation: The 2 to 1 codecs do a number of operations where they "peek" the pseudo-headers. Each of these operations uses the HPACKHeaders subscript, meaning that they allocate a temporary array for a field that can, in a correct request/response, contain only one element. That's very wasteful! Modifications: - Rewrite peekPseudoHeader to iterate instead, avoiding the array. - Add allocaton counter test. Result: 4 fewer allocations per HTTP request transformed on the server side, 2 fewer allocations per HTTP response transformed on the client side.