-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Galloping search for binary_search_util #67948
Conversation
r? @zackmdavis (rust_highfive has picked a reviewer for you, use r? to override) |
Btw. I have a quickcheck test to test against master, but that probably shouldn't run with every build. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Algorithm looks correct, though I can't say that I can follow it super closely (would likely need to sketch it out on paper to review thoroughly). Since you've tested with quickcheck though and it seems to match my understanding of what it should look like, this seems fine.
r=me with the declarations split onto multiple lines
} else { | ||
// We get back *some* element with the given key -- so do | ||
// a galloping search backwards to find the *first* one. | ||
let (mut start, mut step, mut previous, size) = (mid, 1, mid, data.len()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we declare these on separate lines? My eyes are having trouble correlating initial values with the variable names :)
@bors r+ Thanks! |
📌 Commit 0e1cd59 has been approved by |
Galloping search for binary_search_util This is unlikely to improve perf much unless for synthetic benchmarks, but I figure it likely won't hurt either.
Rollup of 6 pull requests Successful merges: - #67494 (Constify more of alloc::Layout) - #67867 (Correctly check for opaque types in `assoc_ty_def`) - #67948 (Galloping search for binary_search_util) - #68045 (Move more of `rustc::lint` into `rustc_lint`) - #68089 (Unstabilize `Vec::remove_item`) - #68108 (Add suggestions when encountering chained comparisons) Failed merges: r? @ghost
This is unlikely to improve perf much unless for synthetic benchmarks, but I figure it likely won't hurt either.