-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Use a single map for the CurrentDepGraph #65146
Use a single map for the CurrentDepGraph #65146
Conversation
An IndexMap instead of a HashMap and IndexVec is used. Internally this is much the same, but wrapping the two into one data structure is less prone to accidents of updating just one and is cleaner.
@bors try @rust-timer queue Let's gather some performance statistics here regardless of my beliefs that this shouldn't matter :) |
Awaiting bors try build completion |
⌛ Trying commit c06df08 with merge 660d33983d348bd1162b1c3d8619df49a4c76706... |
I also have a follow-up PR that removes |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
☀️ Try build successful - checks-azure |
Queued 660d33983d348bd1162b1c3d8619df49a4c76706 with parent 7870050, future comparison URL. |
Finished benchmarking try commit 660d33983d348bd1162b1c3d8619df49a4c76706, comparison URL. |
Hm, so it's somewhat true that this conflicts with #61845 -- but I don't feel like it does so in a major way? That is, we likely then just want a ShardedIndexMap and making one doesn't seem too hard, right? It is added work, but that doesn't seem like an entirely bad thing to me, since it's mostly about introducing an otherwise helpful abstraction. The main reason I thought it'd be good to this is because for #63756, this makes the lock movement to the interior much more obvious, rather than having to think of whether the change introduces lock ordering issues and such. Potentially also less helpful, though. |
So, the change looks reasonable and straightforward but there is a noticeable slowdown on perf.rlo. I suspect that is because |
Yeah, that's probably true. I agree that given the performance delta we should probably close. |
An IndexMap instead of a HashMap and IndexVec is used. Internally this is much the same, but wrapping the two into one data structure is less prone to accidents of updating just one and is cleaner. Big-O lookups are the same as previously for DepNode/DepNodeIndex, so performance wise this is not expected to have significant effect. IndexMap retains the same cache characteristics though at our size it probably has little to no effect.
Changes here are pretty straightforward, though could be made even more so with an addition to librustc_index that exposes a wrapper around IndexMap which seamlessly presents
Idx
implementing indices rather than needing conversions to/fromusize
(which may even be costly, but this is unlikely).cc @Zoxc as this'll both conflict but also help with #63756, at least from an audit perspective
r? @michaelwoerister @nikomatsakis