3 ms·
That particular branch is well-predicted for long arrays. You probably only gonna have a single misprediction for the complete binary search function, the perfo
by Const-me 3y ago
That particular branch is well-predicted for long arrays. You probably only gonna have a single misprediction for the complete binary search function, the performance consequence of that branch is negligible.
People (and compilers, too) don’t write branchless code just for the sake of it, they do because it helps with performance.
- kragen 3y agosometimes branchless code also stops timing side channel attacks, but it's not enough by itself