Expand description
Reusable buffer pool for decompression output buffers.
Pools Vec<u8> buffers to reduce allocator pressure during
sequential and parallel decompression.
Reusable buffer pool for decompression output buffers.
Eliminates per-block Vec<u8> allocations during decompression by pooling
and reusing buffers of common sizes. This is especially important for the
parallel decompression path where N threads hitting the global allocator
concurrently causes contention.
§Design
The pool is a simple Mutex<Vec<Vec<u8>>> stack. Buffers are checked out
for decompression and returned after the decompressed data has been copied
or converted to Bytes.
When a buffer is needed for cache insertion (converting to Bytes), the
buffer is consumed and not returned to the pool. The pool naturally reaches
steady state as the block cache fills up and stops triggering new
decompressions.
Structs§
- Buffer
Pool - A pool of reusable
Vec<u8>buffers for decompression.
Constants§
- DEFAULT_
POOL_ SIZE - Default maximum number of idle buffers to retain in the pool.