rust/library/core
bors 19326022d2 Auto merge of #128254 - Amanieu:orig-binary-search, r=tgross35
Rewrite binary search implementation

This PR builds on top of #128250, which should be merged first.

This restores the original binary search implementation from #45333 which has the nice property of having a loop count that only depends on the size of the slice. This, along with explicit conditional moves from #128250, means that the entire binary search loop can be perfectly predicted by the branch predictor.

Additionally, LLVM is able to unroll the loop when the slice length is known at compile-time. This results in a very compact code sequence of 3-4 instructions per binary search step and zero branches.

Fixes #53823
Fixes #115271
2024-08-02 08:20:35 +00:00
..
benches Reformat use declarations. 2024-07-29 08:26:52 +10:00
src Auto merge of #128254 - Amanieu:orig-binary-search, r=tgross35 2024-08-02 08:20:35 +00:00
tests Rewrite binary search implementation 2024-07-30 17:07:56 +01:00
Cargo.toml Cleanup bootstrap check-cfg 2024-06-27 11:30:03 +02:00