mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
Motivation: As outlined in https://bugs.swift.org/browse/SR-13923, removeAll(keepingCapacity:) on Array has particularly negative performance when that Array is not uniquely referenced. In this case, in EmbeddedChannel, we _arrange_ to multiply reference it. This makes it swamp our HTTP/2 microbenchmarks, spending more cycles copying this buffer around than doing anything else. Modifications: - Just allocate a new buffer instead. Result: Much less copying.