-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Conversation
r? @dtolnay (rust_highfive has picked a reviewer for you, use r? to override) |
2263a2c
to
4decb58
Compare
You can speed up test/bench runs with sscache and |
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. |
Ping from triage |
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.
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
@bors r+ |
📌 Commit 4decb58 has been approved by |
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
☀️ Test successful - checks-azure |
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