Introducing Zigrupt: a high-performance inter-thread event broadcasting library for Zig

Zigrupt


  • Zigrupt is heavily inspired by the LMAX Disruptor.
  • It lets application threads publish events once and have multiple handlers process every event, in order, on their own threads.
  • It uses a ring buffer, atomics and memory barriers to make the even broadcasting lock-free, plus it uses cache-line optimizations to avoid false-sharing, adding all those up you get very low latency when compared to a simple mutex based queue. These optimizations were adapted from the LMAX design itself.
  • Benchmarks with two similar tool in Java and Rust. Zigrupt outperforms them or give similar performance(there’s some cases where the Zigrupt lags behind which I am working on to resolve)

Ongoing development and release:

Although I released an early version(v0.0.1), this is still a WIP as I did not yet implement all the features that the OG LMAX disruptor supports for example consumer dependencies etc.

Supported Zig versions: 0.16

AI / LLM usage disclosure

The implementation of the zigrupt was done by me with my hands but I used the AI to write documentation, benchmarking tool and also have it write many of my application tests.