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

introduce benchmarks of HashSet operations #66393

Merged
merged 1 commit into from
Nov 24, 2019
Merged

Conversation

ssomers
Copy link
Contributor

@ssomers ssomers commented Nov 14, 2019

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

@rust-highfive
Copy link
Collaborator

r? @dtolnay

(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 Nov 14, 2019
@Centril
Copy link
Contributor

Centril commented Nov 14, 2019

cc @scottmcm @bluss

@the8472
Copy link
Member

the8472 commented Nov 14, 2019

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

You can speed up test/bench runs with sscache and x.py [...] --stage 0. This way building + running all libcore tests takes about 3 minutes for me.

@ssomers
Copy link
Contributor Author

ssomers commented Nov 15, 2019

You can speed up test/bench runs with sscache

Wow, what a hack! I'd rather go back to the competition at liballoc incorporated. Add or edit a unit test or benchmark, and build and run in 30 seconds.

@JohnCSimon
Copy link
Member

Ping from triage
@dtolnay - can you please review this PR?
Thank you!

Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! FWIW here are the measurements on my machine:

$ ./x.py bench libstd --stage 0
...
     Running build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps/lib-d04102421a4d0289

running 12 tests
test hash::map::find_existing                ... bench:      12,987 ns/iter (+/- 133)
test hash::map::find_nonexisting             ... bench:      13,521 ns/iter (+/- 222)
test hash::map::get_remove_insert            ... bench:          81 ns/iter (+/- 30)
test hash::map::grow_by_insertion            ... bench:         125 ns/iter (+/- 11)
test hash::map::hashmap_as_queue             ... bench:          49 ns/iter (+/- 8)
test hash::map::new_drop                     ... bench:           4 ns/iter (+/- 0)
test hash::map::new_insert_drop              ... bench:          53 ns/iter (+/- 1)
test hash::set_ops::set_difference           ... bench:         158 ns/iter (+/- 7)
test hash::set_ops::set_intersection         ... bench:         159 ns/iter (+/- 3)
test hash::set_ops::set_is_subset            ... bench:         158 ns/iter (+/- 3)
test hash::set_ops::set_symmetric_difference ... bench:       1,958 ns/iter (+/- 29)
test hash::set_ops::set_union                ... bench:         358 ns/iter (+/- 11)

test result: ok. 0 passed; 0 failed; 0 ignored; 12 measured; 0 filtered out

@dtolnay
Copy link
Member

dtolnay commented Nov 24, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Nov 24, 2019

📌 Commit 4decb58 has been approved by dtolnay

@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 Nov 24, 2019
@bors
Copy link
Contributor

bors commented Nov 24, 2019

⌛ Testing commit 4decb58 with merge b56b239...

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
@bors
Copy link
Contributor

bors commented Nov 24, 2019

☀️ Test successful - checks-azure
Approved by: dtolnay
Pushing b56b239 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 24, 2019
@bors bors merged commit 4decb58 into rust-lang:master Nov 24, 2019
@ssomers ssomers deleted the hash_benches branch January 22, 2020 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

8 participants