# `quickring`
This library provides a very fast, lock-free SPSC ring buffer implementation in Rust.
It can perform 1 billion writes and reads in ~1.76s on my MacBook Air M2,
on `usize` data with a capacity of 8192.
## Features
- Very high performance.
- Generic over any data type.
- Compile-time static capacity.
- Split into producer and consumer (SPSC) for concurrent use.
## Usage
Run `cargo add quickring` to add it to your project, or add the following to your `Cargo.toml`:
```toml
[dependencies]
quickring = "*"
```
Then, you can use it as follows:
```rust
use quickring::RingBuffer;
const OPERATIONS: usize = 1_000_000;
const CAPACITY: usize = 1 << 13; // 8192
let rb: RingBuffer<usize, CAPACITY> = RingBuffer::new();
let (mut tx, mut rx) = rb.split();
// Create a producer thread
while !tx.push(i) {}
}
});
// Create a consumer thread
loop {
if let Some(_) = rx.pop() {
break;
}
}
}
});
producer.join().unwrap();
consumer.join().unwrap();
```