News for hackers. Stuff that matters.
Re:I've been writing ring buffers wrong all these years by jnordwick on Wednesday December 14, 2016 @04:38PM (#13179894)
The branch will be properly predicted every time except for when it wraps. This should be faster than any of the alternatives.
Re:I've been writing ring buffers wrong all these years by dllthomas on Wednesday December 14, 2016 @05:56PM (#13180500)
I fully believe that there are plenty of contexts where that's true - particularly in any throughput oriented system where the buffer is large. But if you care, measure.