pool
Package pool
import "github.com/luxfi/node/utils/pool"Types
BufferPool
BufferPool is a pool for bytes.Buffer objects
func NewBufferPool() *BufferPoolfunc (p *BufferPool) Get() *bytes.Bufferfunc (p *BufferPool) Put(buf *bytes.Buffer)ByteSlicePool
ByteSlicePool is a pool for byte slices of a specific size
func NewByteSlicePool(size int) *ByteSlicePoolfunc (p *ByteSlicePool) Get() []bytefunc (p *ByteSlicePool) Put(b []byte)MapPool
MapPool provides pooling for maps
func NewMapPool[K comparable, V any]() *MapPool[K, V]func (p *MapPool[K, V]) Get() map[K]Vfunc (p *MapPool[K, V]) Put(m map[K]V)ObjectPool
ObjectPool provides a generic object pool for reducing allocations
func NewObjectPool[T any](new func() T, reset func(T)) *ObjectPool[T]func (p *ObjectPool[T]) Get() Tfunc (p *ObjectPool[T]) Put(obj T)SlicePool
SlicePool provides pooling for slices
func NewSlicePool[T any](initialCap int) *SlicePool[T]func (p *SlicePool[T]) Get() []Tfunc (p *SlicePool[T]) Put(s []T)