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

Galloping search for binary_search_util #67948

Merged
merged 1 commit into from
Jan 12, 2020
Merged

Conversation

llogiq
Copy link
Contributor

@llogiq llogiq commented Jan 6, 2020

This is unlikely to improve perf much unless for synthetic benchmarks, but I figure it likely won't hurt either.

@rust-highfive
Copy link
Collaborator

r? @zackmdavis

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 6, 2020
@llogiq
Copy link
Contributor Author

llogiq commented Jan 7, 2020

Btw. I have a quickcheck test to test against master, but that probably shouldn't run with every build.

@llogiq
Copy link
Contributor Author

llogiq commented Jan 11, 2020

r? @Mark-Simulacrum

Copy link
Member

@Mark-Simulacrum Mark-Simulacrum left a 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());
Copy link
Member

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 :)

@Mark-Simulacrum
Copy link
Member

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Jan 12, 2020

📌 Commit 0e1cd59 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 12, 2020
Centril added a commit to Centril/rust that referenced this pull request Jan 12, 2020
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.
bors added a commit that referenced this pull request Jan 12, 2020
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
@bors bors merged commit 0e1cd59 into rust-lang:master Jan 12, 2020
@llogiq llogiq deleted the gallop branch January 12, 2020 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants