builderpool

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package builderpool is a small wrapper of sync.Pool to hold bytes.Buffer.

Derived from https://github.com/nasa9084/go-builderpool 0ff03b3

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteBuilderPool

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

ByteBuilderPool is wrapper struct of sync.Pool for bytes.Buffer objects. A comparison against strings.Builder showed that bytes,Buffer is much more effective to pool. Using ByteBuilderPool is about 10% faster than plain strings.Builder or bytes.Buffer.

func NewB

func NewB() *ByteBuilderPool

NewB returns a new ByteBuilderPool instance.

func (*ByteBuilderPool) Get

func (bp *ByteBuilderPool) Get() *bytes.Buffer

Get returns a bytes.Buffer from the pool.

func (*ByteBuilderPool) Release

func (bp *ByteBuilderPool) Release(b *bytes.Buffer)

Release puts the given strings.Builder back into the pool after resetting the builder.

Jump to

Keyboard shortcuts

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