pool

package
v0.2.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: Unlicense Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBitmap

func GetBitmap() *roaring.Bitmap

GetBitmap retrieves an empty bitmap from the global pool.

func PutBitmap

func PutBitmap(bm *roaring.Bitmap)

PutBitmap returns a bitmap to the global pool after clearing it.

Types

type BitmapPool

type BitmapPool struct {
	// contains filtered or unexported fields
}

BitmapPool manages a pool of *roaring.Bitmap objects to reduce GC pressure.

func (*BitmapPool) Get

func (p *BitmapPool) Get() *roaring.Bitmap

Get retrieves an empty bitmap from the pool. The clear is not redundant with the one in Put: it is what makes "every Get returns an empty bitmap" hold for the pool regardless of how an object entered it, so a caller that recycles a bitmap it does not exclusively own can never leak its contents to the next owner. roaring's Clear only resets the container index, so it costs the same whether or not there is anything to drop.

func (*BitmapPool) Put

func (p *BitmapPool) Put(bm *roaring.Bitmap)

Put returns a bitmap to the pool after clearing it.

type BytePool

type BytePool struct {
	// contains filtered or unexported fields
}

BytePool pools bytes.Buffer instances to reduce allocation pressure in hot paths (WAL, serialization).

func NewBytePool

func NewBytePool() *BytePool

NewBytePool creates a new buffer pool.

func (*BytePool) Get

func (p *BytePool) Get() *bytes.Buffer

Get retrieves a buffer from the pool. The buffer is guaranteed to be empty (Reset called).

func (*BytePool) Put

func (p *BytePool) Put(buf *bytes.Buffer)

Put returns a buffer to the pool after resetting it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL