From 12M ops/s to 305 M ops/s on a lock-free ring buffer.
In this post, I walk you step by step through implementing a single-producer single-consumer queue from scratch.
This pattern is widely used to share data between threads in the lowest-latency environments.
sanufar 25 minutes ago [-]
Super fun, def gonna try this on my own time later
kristianp 19 hours ago [-]
This is in C++, other languages have different atomic primitives.
jitl 17 minutes ago [-]
Really? Pretty much all atomics i’ve used have load,
store of various integer sizes. I wrote a ring buffer in Go that’s very similar to the final design here using similar atomics.
In this post, I walk you step by step through implementing a single-producer single-consumer queue from scratch.
This pattern is widely used to share data between threads in the lowest-latency environments.
https://pkg.go.dev/sync/atomic#Int64