mirror of
https://github.com/apple/swift-nio-http2
synced 2026-11-24 04:38:00 +00:00
Motivation: HPACKHeaders is a trivial data structure (a wrapper around Array) that is present in the public API of all NIO HTTP/2 programs. This makes it a tempting target for adding inlinable calls, primarily as a way to drive down ARC. The fact that strings frequently travel across the API boundary means that otherwise innocuous use-cases can trigger unexpected ARC traffic. Making as much of the implementation inlinable as possible reduces a lot of this overhead and opens up the possibility for better performance in a number of parts of the code, including in the core HTTP/2 protocol engine, which operates extensively on this data type. Modifications: - Make basically everything inlinable. Result: Our benchmarks are about 0.7% faster.