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

Iuri Chaer via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 31 07:10:42 PDT 2024


ichaer wrote:

@alexfh, I did think of that when proposing the change, but I couldn't think of a good way to help users. Your idea of adding validation to the hardening modes sounds good to me, I've got my hands full right now, but I'll open a PR for that as soon as I can.

The case you shared, with `{944, 3982, 10041, 443}` and `{10041}`, is easy to detect cheaply, but if the last entry were `3982` instead it would be trickier... I'm torn on this. What did you have in mind, a full scan over inputs to check if they are sorted, or the cheap but much weaker validation that we can't reach a value which is less than the previous one we've inspected?

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


More information about the libcxx-commits mailing list