Context - `RingBuffer.read()` allocates a new Float32Array for every window/segment read. - v3/v2 and segment extraction call `read()` frequently (windowing + segment verification). Evidence - `src/lib/audio/RingBuffer.ts` (read allocates) - `src/lib/audio/AudioEngine.ts` uses `ringBuffer.read()` in `processWindowCallbacks` and segment extraction. - `src/App.tsx` v2/v3 paths read full windows for transcription. Impact - Per-window allocations increase GC pressure and CPU during capture. Actions - Prefer `readInto()` with a reused buffer for window reads. - For window streaming, consider a SharedArrayBuffer ring to avoid copies. - Add metrics to compare allocation counts before/after. Acceptance - Allocation rate during recording decreases (observed via Performance/Memory). - Worker GC time reduced in a 30s capture.
Context
RingBuffer.read()allocates a new Float32Array for every window/segment read.read()frequently (windowing + segment verification).Evidence
src/lib/audio/RingBuffer.ts(read allocates)src/lib/audio/AudioEngine.tsusesringBuffer.read()inprocessWindowCallbacksand segment extraction.src/App.tsxv2/v3 paths read full windows for transcription.Impact
Actions
readInto()with a reused buffer for window reads.Acceptance