-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate binary search codes of binary_search_by and partition_point #85406
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
Sounds good! But I think it's unrelated to this PR itself and can be done in another PR. |
r? @JohnTitor @bors r+ |
📌 Commit 5db13c5 has been approved by |
…=JohnTitor Integrate binary search codes of binary_search_by and partition_point For now partition_point has own binary search code piece. It is because binary_search_by had called the comparer more times and the author (=me) wanted to avoid it. However, now binary_search_by uses the comparer minimum times. (rust-lang#74024) So it's time to integrate them. The appearance of the codes are a bit different but both use completely same logic.
☀️ Test successful - checks-actions |
…ochenkov Prefer `partition_point` to look up assoc items Since we now have `partition_point` (instead of `equal_range`), I think it's worth trying to use it instead of manually finding it. `partition_point` uses `binary_search_by` internally (rust-lang#85406) and its performance has been improved (rust-lang#74024), so I guess this will make a performance difference.
For now partition_point has own binary search code piece.
It is because binary_search_by had called the comparer more times and the author (=me) wanted to avoid it.
However, now binary_search_by uses the comparer minimum times. (#74024)
So it's time to integrate them.
The appearance of the codes are a bit different but both use completely same logic.