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 (*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.
Click to show internal directories.
Click to hide internal directories.