pools

package
v0.0.0-...-c69f244 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: LGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DigestBuffers = &sync.Pool{
	New: func() interface{} {
		const bufferCapacity = 32
		b := make([]byte, 0, bufferCapacity)
		return bytes.NewBuffer(b)
	},
}

DigestBuffers is a sync pool of buffers of capacity 32.

View Source
var EncodingBuffers = &sync.Pool{
	New: func() interface{} {
		const initialBufferCapacity = 1900000 // 1.9MB, from checking capacities at runtime
		b := make([]byte, 0, initialBufferCapacity)
		return bytes.NewBuffer(b)
	},
}

EncodingBuffers is a sync pool of buffers of capacity 1.9MB.

View Source
var Hashers = &sync.Pool{
	New: func() interface{} {
		hasher, err := blake2b.New256(nil)
		if err != nil {

			panic("cannot create Blake2b-256 hasher: " + err.Error())
		}
		return hasher
	},
}

Hashers is a sync pool of blake2b 256 hashers.

View Source
var SingleByteBuffers = &sync.Pool{
	New: func() interface{} {
		const bufferLength = 1
		b := make([]byte, bufferLength)
		return bytes.NewBuffer(b)
	},
}

SingleByteBuffers is a sync pool of buffers of capacity 1.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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