SPSCQueue icon indicating copy to clipboard operation
SPSCQueue copied to clipboard

Why align the cached indices?

Open nlyan2025 opened this issue 4 weeks ago • 0 comments

I'm curious why the cached indices are themselves cache line aligned.

Every time you load the write index you also load the cached read index.

The same is also true for the read case (every time you load the read index you also load the cached write index)

Putting these in separate cachelines makes no sense, unless there's a reason that the CPU could make some kind of speculative progress with only one of these values available that it couldn't otherwise?

nlyan2025 avatar Dec 11 '25 10:12 nlyan2025