apple / swift-nio-http2

HTTP/2 support for SwiftNIO
https://swiftpackageindex.com/apple/swift-nio-http2/main/documentation/niohttp2
Apache License 2.0
462 stars 82 forks source link

Keep capacity when dropping pending reads in the stream channel #447

Closed glbrntt closed 2 months ago

glbrntt commented 2 months ago

Motivation:

When the stream channel has closed it drops all of its pending reads. It does this by calling 'removeAll()' on its CircularBuffer. The buffers underlying storage is emptied and then a nil is appended (internally CircularBuffer is never empty) which triggers an allocation.

Modifications:

Result:

Fewer allocations