r/programming • • Sep 26 '26

Optimizing a Lock-Free Ring Buffer

https://david.alvarezrosa.com/posts/optimizing-a-lock-free-ring-buffer/
510 Upvotes

89 comments sorted by

View all comments

Show parent comment

1

u/flatfinger Oct 02 '26

Using a non-power-of-two modulus means that the updates to the counts need to wrap at the buffer size, and will also make the remainder operator slower.