NHacker Next
  • new
  • past
  • show
  • ask
  • show
  • jobs
  • submit
Optimizing a Lock-Free Ring Buffer (david.alvarezrosa.com)
dalvrosa 20 hours ago [-]
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.

https://pkg.go.dev/sync/atomic#Int64

dalvrosa 16 hours ago [-]
Yeah right, this is quite specific to C++
hedal 2 days ago [-]
best
dalvrosa 2 days ago [-]
Thanks!
lukesergei 2 days ago [-]
lol
dalvrosa 2 days ago [-]
:)
Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact
Rendered at 14:15:41 GMT+0000 (Coordinated Universal Time) with Vercel.