mirror of
https://github.com/apple/swift-nio-ssl
synced 2026-11-26 04:57:52 +00:00
Motivation: The current implementation of doUnbufferWrites has the unfortunate habit of both causing a substantial amount of ARC traffic and also allocating a promise for all writes, even when one isn't necessary. Worse, if there are many promises in a single set of flushes then we will also have to allocate a future callback to cascade each result. All of this leads to excessive pressure on the memory systems in Swift. Modifications: Refactor the code to avoid excessive use of closures, reducing ARC. Rewrite promise chaining to reduce allocations of closure contexts and promises. Result: Better performance in doUnbufferWrites