Repo: https://github.com/codenimja/nimsync
nimble install nimsync nimble bench → 213M ops/sec
Feedback welcome.
For reference, a 100 line C implementation of Vyukov's queue https://github.com/b0bleet/cmpmc.
The advertized benchmark here doesn't measure much. A single thread is pushing an item and popping an item to the queue one at a time. And it actually measures how many of these operations failed and reports that as "contention rate" ;)
In the queue implementation here the queue is claimed to be SPSC, but uses atomic values for head and tail. Some later commits introduced additional atomic counter for the head for the MPSC mode (???). By the way, nim has {.align.}, no need to insert padding manually.
But what is the goal here? Is author trying to solve some problem? To learn something? Is it some homework project?
@Araq @Isofruit @elcritch @darkestpigeon
Thanks for the feedback — sharp as always.
@Araq: v1.1.0: SPSC + MPSC (single consumer). Async via Chronos (send/recv). Multi-threaded via spawn + MPSC (2 producers: 15M ops/sec realistic). Zero GC with ORC. Goal: p2p pipelines (Waku-style) without pauses.
@Isofruit @elcritch: Running thread-sanitizer, helgrind, valgrind next. Stress tests (spawn storm, backpressure) passed clean in CI. PRs with test scripts welcome.
@darkestpigeon:
Repo: https://github.com/codenimja/nimsync
v1.1.0 production-ready. Feedback/PRs welcome.
boonzy u/Bo0nzy