Skip to content
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

Rewrite binary search implementation #128254

Merged
merged 1 commit into from
Aug 2, 2024
Merged

Commits on Jul 30, 2024

  1. Rewrite binary search implementation

    This restores the original binary search implementation from rust-lang#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 rust-lang#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 rust-lang#53823
    Amanieu committed Jul 30, 2024
    Configuration menu
    Copy the full SHA
    bb58488 View commit details
    Browse the repository at this point in the history