A variable size buffer pool for go.
This library provides:
BufferPool: A pool for re-using byte slices of varied sizes. This pool will always return a slice with at least the size requested and a capacity up to the next power of two. Each size class is pooled independently which makes the BufferPool more space efficient than a plain sync.Pool when used in situations where data size may vary over an arbitrary range.Buffer: a buffer compatible with bytes.Buffer but backed by a BufferPool. Unlike bytes.Buffer, Buffer will automatically "shrink" on read, using the buffer pool to avoid causing too much work for the allocator. This is primarily useful for long lived buffers that usually sit empty.Reduces Memory Usage:
Reduces CPU usage:
PRs are welcome!
Small note: If editing the Readme, please conform to the standard-readme specification.
MIT © Protocol Labs BSD © The Go Authors
The last gx published version of this module was: 0.1.3: QmQDvJoB6aJWN3sjr3xsgXqKCXf4jU5zdMXpDMsBkYVNqa
Overall
Maintained
Code review
Go module
Latest release
Releases this year
318 followers · starred Dec 2022
157 followers · starred Feb 2024
70 followers · starred Feb 2024
44 followers · starred Nov 2023
A variable size buffer pool for go.
This library provides:
BufferPool: A pool for re-using byte slices of varied sizes. This pool will always return a slice with at least the size requested and a capacity up to the next power of two. Each size class is pooled independently which makes the BufferPool more space efficient than a plain sync.Pool when used in situations where data size may vary over an arbitrary range.Buffer: a buffer compatible with bytes.Buffer but backed by a BufferPool. Unlike bytes.Buffer, Buffer will automatically "shrink" on read, using the buffer pool to avoid causing too much work for the allocator. This is primarily useful for long lived buffers that usually sit empty.Reduces Memory Usage:
Reduces CPU usage:
PRs are welcome!
Small note: If editing the Readme, please conform to the standard-readme specification.
MIT © Protocol Labs BSD © The Go Authors
The last gx published version of this module was: 0.1.3: QmQDvJoB6aJWN3sjr3xsgXqKCXf4jU5zdMXpDMsBkYVNqa
Overall
Maintained
Code review
Go module
Latest release
Releases this year
318 followers · starred Dec 2022
157 followers · starred Feb 2024
70 followers · starred Feb 2024
44 followers · starred Nov 2023