Documentation
¶
Overview ¶
Package pool provides allocation-efficient data structures for high-throughput DDS workloads on embedded and edge hardware.
BytePool recycles fixed-capacity byte slices via sync.Pool, reducing GC pressure on fast publish paths that would otherwise allocate a new buffer per sample.
SampleBuffer is a fixed-capacity ring buffer of dds.Sample values. It provides bounded, allocation-free queuing that can be used as a staging area between a subscriber channel and an application processing loop.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BytePool ¶
type BytePool struct {
// contains filtered or unexported fields
}
BytePool is a sync.Pool-backed pool of byte slices with a fixed capacity. Use Get to obtain a zero-length, pre-allocated buffer, write into it, and return it with Put when done. The pool prevents per-sample heap allocations on hot publish paths.
func New ¶
New returns a BytePool whose Get method returns slices with the given capacity. Callers may append up to size bytes without triggering a new allocation.
type SampleBuffer ¶
type SampleBuffer struct {
// contains filtered or unexported fields
}
SampleBuffer is a fixed-capacity concurrent ring buffer of dds.Sample values. It provides bounded, allocation-free queuing suitable for use as a staging area between a subscriber channel and an application processing loop running at a different rate.
func NewSampleBuffer ¶
func NewSampleBuffer(capacity int) *SampleBuffer
NewSampleBuffer returns a SampleBuffer with the given capacity. A capacity of ≤ 0 uses the default of 64.
func (*SampleBuffer) Cap ¶
func (sb *SampleBuffer) Cap() int
Cap returns the buffer's maximum capacity.
func (*SampleBuffer) Len ¶
func (sb *SampleBuffer) Len() int
Len returns the number of samples currently held in the buffer.