4 ms·
Pretty interesting that a branchless linear search would be faster than a branching binary search! It makes sense, it just goes against the normal intuition. Ju
by brundolf 5y ago
Pretty interesting that a branchless linear search would be faster than a branching binary search! It makes sense, it just goes against the normal intuition. Just goes to show that benchmarking is always important
- rstuart4133 5y ago> it just goes against the normal intuition. To me it's perfectly intuitive. However, the other example he gave blew me away: return if cond { ... } else { ... } The compiler evaluating both results and chosing the right one using a cmov, rather than using a branch to evaluate just one result. My how times have changed.