Fix HashSet::union performance#66280
Merged
bors merged 1 commit intorust-lang:masterfrom Nov 12, 2019
Merged
Conversation
Consider this example: small_set = 0..2, large_set = 0..1000. To efficiently compute the union of these sets, we should * take all elements of the larger set * for each element of the smaller set check it is not in the larger set This is exactly what this commit does. This particular optimization was implemented a year ago, but the author mistaken `<` and `>`.
Contributor
|
(rust_highfive has picked a reviewer for you, use r? to override) |
Member
|
@bors: r+ rollup |
Collaborator
|
📌 Commit 04a237b has been approved by |
Contributor
|
What happened is that I measured it on free standing code with free standing benchmarks, and the code must have gotten mangled while transplanting it into libstd, and I didn't even try to transplant benchmarks. In general, there are few benchmarks in libstd/collections/hash compared to liballoc/benches/btree. I could make some but I guess it's too late to include in this PR. |
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this pull request
Nov 12, 2019
Fix HashSet::union performance Consider this example: small_set = 0..2, large_set = 0..1000. To efficiently compute the union of these sets, we should * take all elements of the larger set * for each element of the smaller set check it is not in the larger set This is exactly what this commit does. This particular optimization was implemented a year ago, but the author mistaken `<` and `>`.
bors
added a commit
that referenced
this pull request
Nov 12, 2019
Rollup of 11 pull requests Successful merges: - #65965 (Clean up librustc_typeck error_codes file) - #66230 (remove vestigial comments referring to defunct numeric trait hierarchy) - #66241 (bump openssl version) - #66257 (Drop long-section-names linker workaround for windows-gnu) - #66263 (make the error message more readable) - #66267 (Add rustdoc doc) - #66276 (Move lock into CodeStats) - #66278 (Fix error message about exported symbols from proc-macro crates) - #66280 (Fix HashSet::union performance) - #66299 (support issue = "none" in unstable attributes ) - #66309 (Tiny cleanup to size assertions) Failed merges: r? @ghost
Contributor
|
Quite a lot better than correcting the "still measurable" improvement I reported in #57043, whatever it was that I tested. |
bors
added a commit
that referenced
this pull request
Nov 24, 2019
introduce benchmarks of HashSet operations To avoid goofs such as corrected by #66280, I added benchmarks of binary HashSet operations. Due to the fact x.py keeps recompiling the whole shebang (or at least a big part of it) whenever you touch the test code, and because piling up all tests in one file does not strike me as future proof, I tried moving the hash benches to the separate place they are for liballoc/collections/btree. But it turns out that, in a cleaned checkout, x.py still recompiles the whole shebang whenever you touch the test code (PS or when you add or delete any irrelevant file). So I'm not going to add more tests, and I doubt others will, and these tests have proven their point already, so this PR is kind of pointless
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Consider this example: small_set = 0..2, large_set = 0..1000.
To efficiently compute the union of these sets, we should
This is exactly what this commit does.
This particular optimization was implemented a year ago, but the
author mistaken
<and>.