Expand description
§Buffer Pool
Object pool for frequently allocated small buffers (<4KB) to reduce allocation overhead in high-throughput scenarios.
§Performance
- 3-5% latency reduction under high load
- Eliminates allocator contention for small buffers
- Thread-safe with minimal lock contention
§Usage
use network_protocol::utils::buffer_pool::BufferPool;
let pool = BufferPool::new(100); // 100 buffers in pool
let mut buffer = pool.acquire();
// Use buffer...
// Buffer automatically returned to pool on dropStructs§
- Buffer
Pool - Thread-safe buffer pool for small allocations
- Pooled
Buffer - A pooled buffer that returns itself to the pool when dropped