3 ms·
They both have an offset, but ring buffers aren’t contiguous so they also need a branch or modulus to handle wrap around. Either can be cheap, but clearly that
by manwe150 2y ago
They both have an offset, but ring buffers aren’t contiguous so they also need a branch or modulus to handle wrap around. Either can be cheap, but clearly that is strictly more costly than not having the extra operation (even if very little). Only matters for random indexing also, since for mutation the situation is swapped
- ufo 2y agoThere are many situations where those little differences completely vanish because of instruction pipelining. Only way to know is to actually measure it.