Documentation ¶
Overview ¶
Package pbytes contains tools for pooling byte pool. Note that by default it reuse slices with capacity from 128 to 65536 bytes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultPool = New(128, 65536)
DefaultPool is used by pacakge level functions.
Functions ¶
func Get ¶
Get returns probably reused slice of bytes with at least capacity of c and exactly len of n. Get is a wrapper around DefaultPool.Get().
func GetCap ¶
GetCap returns probably reused slice of bytes with at least capacity of n. GetCap is a wrapper around DefaultPool.GetCap().
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool contains logic of reusing byte slices of various size.
func New ¶
New creates new Pool that reuses slices which size is in logarithmic range [min, max].
Note that it is a shortcut for Custom() constructor with Options provided by pool.WithLogSizeMapping() and pool.WithLogSizeRange(min, max) calls.
func (*Pool) Get ¶
Get returns probably reused slice of bytes with at least capacity of c and exactly len of n.