Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is based on the D version by Alex Muscar, which was based on an implementation in Writing Efficient Programs by Jon L. Bentley. It was originally published by Knuth and is attributed to Shar. https://muscar.eu/shar-binary-search-meta.html Previously, I had mistaken the monobound binary search for a loop version of Shar's algorithm, but after looking at them more deeply, I realize that they are subtly different. On my Ryzen 7 5800X, this will outperform the monobound binary search on array sizes that are powers of 2 or near powers of 2. Signed-off-by: Richard Yao <[email protected]>
- Loading branch information