← blog

Zero-copy audio pipelines in Rust: the Arc<[f32]> pattern

2026-01-25 · Sam Redmond

IronHollow aims to be zero-copy throughout its pipeline. Here's what that means in practice for an audio library and where it breaks down.

The core pattern: Arc<[f32]>

Audio data in IronHollow passes between pipeline stages as Arc<[f32]> — a reference-counted slice of samples. Cloning an Arc is cheap (one atomic increment); the underlying data is shared. This means that a mixer node receiving audio from four sources doesn't need to copy any of them before summing.

Where it breaks down: in-place operations

Some operations — normalisation, gain application — can be done in place. But shared ownership via Arc means we can't mutate the data if any other reference exists. The pattern I've settled on is Arc::make_mut, which clones the data only if the refcount is greater than one. In a linear pipeline, this is usually a no-op; in a fan-out pipeline, it copies exactly once.

FFT output

The FFT returns a new allocation rather than writing into a caller-provided buffer, because the output size is always the input size and the caller rarely has a pre-allocated buffer of the right size. This is the one place where IronHollow currently allocates on the hot path. A future release will add an output-buffer variant for callers who can manage the allocation themselves.


Also: IronHollow 0.5: SIMD FFT and convolution reverb