4 ms·
Hi stjepang, If the following criteria is met, then perhaps the branch mis-predict penalty is less of a problem: 1. you are sorting a large amount of data, muc
by etep 9y ago
Hi stjepang,
If the following criteria is met, then perhaps the branch mis-predict penalty is less of a problem:
1. you are sorting a large amount of data, much bigger than the CPU LLC
2. you can effectively utilize all cores, i.e. your sort algorithm can parallelize
Perhaps in this case you are memory bandwidth limited. If so, you are probably spending more time waiting on data than waiting on pipe flushes (i.e. consequence of mis-predicts).
- stjepang 9y agoAbsolutely - there are cases when branch misprediction is not the bottleneck. It depends on a lot of factors. Another such case is when sorting strings because every comparison causes a potential cache miss and introduces even more branching, and all that would dwarf that one misprediction.