[libcxx-commits] [libcxx] [libc++] Speed up set_intersection() by fast-forwarding over ranges of non-matching elements with one-sided binary search. (PR #75230)

Alexander Kornienko via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 31 10:02:29 PDT 2024


alexfh wrote:

I didn't think too much about tradeoffs here, but it seems like a full linear scan in `_LIBCPP_HARDENING_MODE_DEBUG` should be totally uncontroversial.

As for a cheaper check for `_LIBCPP_HARDENING_MODE_EXTENSIVE` or even `_LIBCPP_HARDENING_MODE_FAST`, a log(n) sampling while doing the binary search could be helpful and cheap enough, but I'd actually expect some measurements there, especially in case of `_LIBCPP_HARDENING_MODE_FAST`.

https://github.com/llvm/llvm-project/pull/75230


More information about the libcxx-commits mailing list