chromium / subspace

A concept-centered standard library for C++20, enabling safer and more reliable products and a more modern feel for C++ code.; Also home of Subdoc the code-documentation generator.
https://suslib.cc
Apache License 2.0
89 stars 15 forks source link

Binary search algorithm #234

Open danakj opened 1 year ago

danakj commented 1 year ago

Compare https://probablydance.com/2023/04/27/beautiful-branchless-binary-search/ with the algo we copied from the Rust stdlib, on Clang and GCC. Since Clang doesn't compile the linked algo as branchless it's probably not preferrable. Can we fix Clang to do so? Also, should compare with std::lower_bound probably.

danakj commented 1 year ago

See also: https://orlp.net/blog/bitwise-binary-search/