-
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
Upgrade indexmap and use it more #75278
Conversation
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 0215c595e7312af32d7b0ae700685c003e7daba2 with merge 45cb4ac369e8d420fc735c61f879d661b8fd69ca... |
☀️ Try build successful - checks-actions, checks-azure |
Queued 45cb4ac369e8d420fc735c61f879d661b8fd69ca with parent f9c2177, future comparison URL. |
Finished benchmarking try commit (45cb4ac369e8d420fc735c61f879d661b8fd69ca): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
Is the memory usage lower? |
FWIW, I purposely separated the commits, so we can easily back any of these out if one proves troublesome.
The perf results include max-rss -- looks like a mixed bag.
|
max rss is usually really noisy. But those results look like a plausible small win. Usually we can only tell when looking at graphs with a few commits before/after currently (once things are on master). @cuviper, did you expect the performance regression here? The PR description sounded like things should be better, but the results look worse (at least instruction counts). I guess we need to get a cachegrind diff going. |
@Mark-Simulacrum I expected existing uses of The losses here are mostly in |
0215c59
to
1a552da
Compare
Local profiling indicates that reverting just the Symbol change fixes most (maybe all) of the regression on token-stream-stress-check, so I've pushed that up now, let's see if the same holds across the board: @bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 1a552da314d08a32594c3084767c0b7fd2c08b68 with merge c0b91af3cd8f045998932334ba4ed2f40fc547ca... |
☀️ Try build successful - checks-actions, checks-azure |
Queued c0b91af3cd8f045998932334ba4ed2f40fc547ca with parent 8bc801b, future comparison URL. |
Finished benchmarking try commit (c0b91af3cd8f045998932334ba4ed2f40fc547ca): comparison url. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up. @bors rollup=never |
Docs still show ~0.5% increase in instructions across the board, but everything else looks neutral or improved. Flipping to cpu-cycles, it looks better almost everywhere, even for docs. It's quite plausible that the new hashbrown-based indexmap would have better IPC, with its SIMD lookups and all. The reverted |
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.
r=me with comment resolved, and ideally the revert commit squashed in or amended with explanation
TerminatorKind::SwitchInt { | ||
discr: Operand::Copy(place), | ||
switch_ty, | ||
values: options.clone().into(), | ||
values: options.into(), |
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.
Hm this looks a bit weird, is there a reason this isn't options.clone()
? Did I miss something?
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.
The values
field is a Cow
. So before, we had a local &Vec<u128>
that could be cloned and converted, and now we have a map and have to collect its values. I guess we could directly collect a Cow
though -- I'll do that.
By "revert commit squashed", do you mean to effectively rebase that change out of existence? That's fine with me. |
Yeah, either rebasing it out of existence or alternatively (maybe better, not sure) leaving it in but editing the message to say why we did so. |
I think it may go unnoticed in the commit history -- I think I'll cut those out and add a new commit with just a comment that |
@bors r=Mark-Simulacrum |
📌 Commit ca0b89a has been approved by |
☀️ Test successful - checks-actions, checks-azure |
First this upgrades
indexmap
to 1.5.1, which is now based onhashbrown::raw::RawTable
. This means it shares a lot of the same performance characteristics for insert, lookup, etc., while keeping items in insertion order.Then across various rustc crates, this replaces a lot of
Vec
+HashMap
pairs with a singleIndexMap
orIndexSet
.Closes #60608.
r? @eddyb