mirror of
https://github.com/apple/swift-nio
synced 2026-11-25 04:47:49 +00:00
Motivation: When running load through EmbeddedChannel we spend an enormous amount of time screwing around with removing things from Arrays. Arrays are not a natural data type for `removeFirst()`, and in fact that method is linear-time on Array due to the need for Array to be zero-indexed. Let's stop using (and indeed misusing) Array on EmbeddedChannel. While we're here, if we add some judicious @inlinable annotations we can also save additional work generating results that users don't need. Modifications: - Replace arrays with circular buffers (including marked versions). - Avoid CoWs and extra allocations on flush. - Make some API methods inlinable to make them cheaper. Result: - Much cheaper EmbeddedChannel for benchmark purposes.