Documentation
¶
Overview ¶
Package throughputbuffer provides a high throughput indefinitely growing io.ReadWriter. It does the minimum amount of copies (1 per read + 1 per write) and never has to move bytes in the buffer.
Memory is freed once read.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a io.ReadWriter that can grow infinitely and does the minimum amount of copies (1 per read + 1 per write) and never has to move bytes.
type BufferPool ¶
type BufferPool struct {
// contains filtered or unexported fields
}
BufferPool holds a sync.Pool of byte slices and can be used to create new Buffers.
func New ¶
func New(blocksize int) *BufferPool
New creates a new BufferPool. The blockSize is the size of the []byte slices internally. The blocksize should be within a few orders of magnitude of the expected size of your buffers. Using a larger blocksize results in more memory being held but unused, a smaller blocksize takes a bit more CPU cycles.
func (*BufferPool) Get ¶
func (p *BufferPool) Get() *Buffer
Get creates a new Buffer using byte slices from this pool.