mirror of
https://github.com/apple/swift-nio
synced 2026-11-25 04:47:49 +00:00
Motivation: Currently, NIOLock and NIOLockedValueBox incur unnecessary allocation and indirection costs. Modifications: Create namespace LockOperations for organization Create LockStorage<Value>, a subclass of ManagedBuffer<LockPrimitive, Value> Store the mutex as the header and the generic value as the first and only element Update NIOLock and NIOLockedValueBox to use LockStorage Result: Optimal lock and value memory layout Fewer allocations and less indirection Code generation is excellent