-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
[PERF EXPERIMENTS] Hashmap experiment #120151
Conversation
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
[PERF EXPERIMENTS] Hashmap experiment I've been thinking about some sort of more efficient way of dealing with small hashmaps, since the vast majority of hashmaps are small.. (non-empty maps only) ``` 0.5..= 1: 0 (0.0%) 1..= 2: 15 (0.0061269%) 2..= 4: 176617 (72.14%) 4..= 8: 203093 (82.955%) 8..= 16: 232412 (94.93%) 16..= 32: 240221 (98.12%) 32..= 64: 243007 (99.258%) 64..= 128: 244165 (99.731%) 128..= 256: 244512 (99.873%) 256..= 512: 244692 (99.946%) 512..= 1024: 244734 (99.963%) 1024..= 2048: 244763 (99.975%) 2048..= 4096: 244780 (99.982%) 4096..= 8192: 244795 (99.988%) 8192..= 16384: 244808 (99.993%) 16384..= 32768: 244816 (99.997%) ``` let's try something with the most popular small map r? `@ghost`
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
💔 Test failed - checks-actions |
93b0a1a
to
f8cb67c
Compare
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
[PERF EXPERIMENTS] Hashmap experiment I've been thinking about some sort of more efficient way of dealing with small hashmaps, since the vast majority of hashmaps are small.. (non-empty maps only) ``` 0.5..= 1: 0 (0.0%) 1..= 2: 15 (0.0061269%) 2..= 4: 176617 (72.14%) 4..= 8: 203093 (82.955%) 8..= 16: 232412 (94.93%) 16..= 32: 240221 (98.12%) 32..= 64: 243007 (99.258%) 64..= 128: 244165 (99.731%) 128..= 256: 244512 (99.873%) 256..= 512: 244692 (99.946%) 512..= 1024: 244734 (99.963%) 1024..= 2048: 244763 (99.975%) 2048..= 4096: 244780 (99.982%) 4096..= 8192: 244795 (99.988%) 8192..= 16384: 244808 (99.993%) 16384..= 32768: 244816 (99.997%) ``` let's try something with the most popular small map r? `@ghost`
This comment has been minimized.
This comment has been minimized.
d800dfd
to
7836b3b
Compare
The job Click to see the possible cause of the failure (guessed by this bot)
|
From the table it sounds like a VecMap might be better for 99% of cases. Terrible for the <1% though. |
@@ -224,7 +223,7 @@ impl<K: Eq + Hash + Copy + IntoPointer> ShardedHashMap<K, ()> { | |||
|
|||
#[inline] | |||
pub fn make_hash<K: Hash + ?Sized>(val: &K) -> u64 { | |||
let mut state = FxHasher::default(); | |||
let mut state = ahash::AHasher::default(); |
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.
Ahash doesn't guarantee determinism of the hash between platforms and versions. This will likely lead to build artifacts that can't be reproduced unless rustc runs on the exact same architecture and likely lead to diagnostics changing between targets. The latter is something we should fix with more sorting anyway, but the former isn't easily avoidable I think.
BTreeMap should be good as well assuming Ord is easy to provide. |
☔ The latest upstream changes (presumably #120454) made this pull request unmergeable. Please resolve the merge conflicts. |
no more hashmaps experiment |
I've been thinking about some sort of more efficient way of dealing with small hashmaps, since the vast majority of hashmaps are small..
(non-empty maps only)
let's try something with the most popular small map
r? @ghost