Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllocationCache ¶
type AllocationCache[T any] struct { // contains filtered or unexported fields }
AllocationCache is a trivial cache of allocations. Put appends a value to a slice and Get pops a value from the slice, or allocates a new value.
func (*AllocationCache[T]) Get ¶
func (c *AllocationCache[T]) Get() *T
func (*AllocationCache[T]) Put ¶
func (c *AllocationCache[T]) Put(x *T)
type BucketSlice ¶
type BucketSlice[T any] struct { // contains filtered or unexported fields }
BucketSlice is like a slice, but grows one bucket at a time, instead of growing exponentially. This allows for overall lower memory usage when the total capacity isn't known ahead of time, at the cost of more overall allocations.
func (*BucketSlice[T]) Append ¶
func (l *BucketSlice[T]) Append(v T) *T
Append appends v to the slice and returns a pointer to the new element.
func (*BucketSlice[T]) Get ¶
func (l *BucketSlice[T]) Get(i int) T
func (*BucketSlice[T]) Len ¶
func (l *BucketSlice[T]) Len() int
func (*BucketSlice[T]) Ptr ¶
func (l *BucketSlice[T]) Ptr(i int) *T
func (*BucketSlice[T]) Reset ¶
func (l *BucketSlice[T]) Reset()
func (*BucketSlice[T]) Set ¶
func (l *BucketSlice[T]) Set(i int, v T)
func (*BucketSlice[T]) Truncate ¶
func (l *BucketSlice[T]) Truncate(n int)
type ConcurrentSliceCache ¶
type ConcurrentSliceCache[E any, T ~[]E] struct { // contains filtered or unexported fields }
ConcurrentSliceCache caches slices, grouped by capacities. When requesting a slice, the requested capacity is rounded up to the next group and then fetched from a sync.Pool dedicated to that group.
func NewConcurrentSliceCache ¶
func NewConcurrentSliceCache[E any, T ~[]E]() *ConcurrentSliceCache[E, T]
func (*ConcurrentSliceCache[E, T]) Get ¶
func (c *ConcurrentSliceCache[E, T]) Get(minCap int) T
func (*ConcurrentSliceCache[E, T]) Put ¶
func (c *ConcurrentSliceCache[E, T]) Put(s T)
type ReusableOps ¶
type ReusableOps struct {
// contains filtered or unexported fields
}