Skip to content

koykov/lbpool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leaky Buffer pool

A pool solution that implements leaky buffer template.

It's slowly than vanilla pool but implements release logic in other hand. sync/pool is a great pool solution but it has a big inconvenience

Any item stored in the Pool may be removed automatically at any time without notification. If the Pool holds the only reference when this happens, the item might be deallocated.

This pool was made special for object like cbyte that requires manual release.

Use it the same as vanilla pools.

Benchmarks

BenchmarkPool-8                 20000000        81.8 ns/op       0 B/op       0 allocs/op
BenchmarkPoolParallel-8         100000000       19.6 ns/op       0 B/op       0 allocs/op
BenchmarkPoolNative-8           50000000        25.6 ns/op       0 B/op       0 allocs/op
BenchmarkPoolNativeParallel-8   200000000       5.54 ns/op       0 B/op       0 allocs/op

LB pool is 4-5 slowest that vanilla since it based on channels, whereas native is based on system pins.