#atomic #vst-plugin #web #gui #queue

atomic-queue

Simple bounded lock-free queue for use in Audio applications, ported from https://github.com/max0x7ba/atomic_queue

5 releases (1 stable)

1.0.1 Sep 22, 2022
1.0.0-alpha.4 May 3, 2022
1.0.0-alpha.3 Apr 7, 2022
1.0.0-alpha.2 Feb 9, 2022
0.1.0 Jul 9, 2021

#15 in #vst-plugin

Download history 11/week @ 2023-06-11 72/week @ 2023-06-18 35/week @ 2023-06-25 103/week @ 2023-07-02 25/week @ 2023-07-09 40/week @ 2023-07-16 35/week @ 2023-07-23 15/week @ 2023-07-30 25/week @ 2023-08-06 38/week @ 2023-08-13 15/week @ 2023-08-20 22/week @ 2023-08-27 37/week @ 2023-09-03 21/week @ 2023-09-10 20/week @ 2023-09-17 19/week @ 2023-09-24

98 downloads per month
Used in 2 crates

MIT license

205KB
317 lines

atomic-queue

crates.io docs.rs


Multi-producer multi-consumer bounded lock-free queue for use in Audio applications, ported from https://github.com/max0x7ba/atomic_queue.

Quite a bit slower than ringbuf (~2x) on i7.

I'd think this is fine since this queue supporting multiple consumers and multiple producers while ringbuf is single producer single consumer.

30% faster on a M1 Pro Macbook.

License

MIT


lib.rs:

atomic_queue is a port of C++'s max0x7ba/atomic_queue implementation to rust.

This is part of augmented-audio.

It provides a bounded multi-producer, multi-consumer lock-free queue that is real-time safe.

Usage

let queue: atomic_queue::Queue<usize> = atomic_queue::bounded(10);

queue.push(10);
if let Some(v) = queue.pop() {
    assert_eq!(v, 10);
}

Safety

This queue implementation uses unsafe internally.

Performance

When benchmarked on a 2017 i7, this was a lot slower than ringbuf (~2x).

I'd think this is fine since this queue supporting multiple consumers and multiple producers while ringbuf is single producer single consumer.

Testing again on a M1 Pro, it is 30% faster.

No runtime deps