|
|
|
|
|
by orlp
1131 days ago
|
|
The benchmarking code is available, I did not: https://github.com/orlp/bitwise-binary-search. The compiler also did not appear to have autovectorized it. That said, I would expect the overhead of vectorization to dominate at smaller sizes, and the fact that linear search is... well... linear to dominate at larger sizes. There might be a sweet spot for a few dozen elements where it would be the best, but I think it'd be rather niche (and strictly limited to floats/integers). Regarding cache effects of linear search, this entire article is under the assumption your data is in-cache, if not your results will vary (wildly). |
|