lvlbp
Leveled byte pool. Inspired by VictoriaMetrics.
Rationale
Instead of having 1 pool for byte slices, we create multiple pools that are serving slices of a particular size. This reduces overhead for the smaller slices, because they will not be resized when we request for the bigger slices. Also library provides stats to see how many allocations do we have for each class.
Install
go get github.com/cristalhq/lvlbp
Example
size := 42
bb := lvlbp.Get(size)
defer lvlbp.Put(bb)
// do something with bb of size `closestPowerOf2(42)`
Documentation
See these docs.
License
MIT License.