Documentation
¶
Overview ¶
Package pool provides a size-class byte buffer pool that eliminates allocations on media-heavy hot paths (audio chunks, image tiles, video frames).
Under millions of concurrent LLM calls the GC cost of per-frame []byte allocations dominates. BytePool provides O(1) amortised Get/Put with no per-operation heap allocation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultBytePool = NewBytePool()
DefaultBytePool is the process-wide byte pool. Providers and processors should use this unless they need isolation.
Functions ¶
This section is empty.
Types ¶
type BytePool ¶
type BytePool struct {
// contains filtered or unexported fields
}
BytePool is a size-class byte buffer pool.
Usage:
buf := pool.DefaultBytePool.Get(frameSize) copy(buf, rawPayload) // ... after consumer is done: pool.DefaultBytePool.Put(buf)
func NewBytePool ¶
func NewBytePool() *BytePool
NewBytePool creates a new BytePool with pre-allocated size classes.
Click to show internal directories.
Click to hide internal directories.