ringbuffer-spsc
A fast #[no_std] single-producer single-consumer (SPSC) ring buffer designed for low-latency and high-throughput scenarios.
For performance reasons, the buffer's capacity must be a power of two. Using a power-of-two capacity lets the implementation wrap indices with a simple bitmask instead of using a slower modulo operation. This reduces computational overhead and improves throughput.
Example
A minimal example showing a simple producer–consumer (cross-thread) pattern.
use ringbuffer;
Performance
The repository includes a throughput example. To run it locally:
Provides ~520M elem/s of sustained throughput when benchmarking the example on an Apple M4, 32 GB of RAM: