-
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
Convert SerializedDepGraph to be a struct-of-arrays #49069
Conversation
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, @wesleywiser! I think this is nicer now. The two tuple components were never used together.
Maybe we can make serialize()
take the DepGraph
by value at some point, then just moving the arrays would certainly be safe.
src/librustc/dep_graph/graph.rs
Outdated
(dep_node, fingerprints[idx]) | ||
}).collect(); | ||
let fingerprints: IndexVec<_, _> = fingerprints.iter().cloned().collect(); | ||
let nodes : IndexVec<_, _> = current_dep_graph.nodes.iter().cloned().collect(); |
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.
We should just use .clone()
on the IndexVec
s directory directly. That will make it more likely that this is a simple memcpy
.
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.
Good idea! I was so busy looking for impl Clone for IndexVec
I totally missed the derive(Clone)
line. 😆
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.
😄
Ping @wesleywiser, did you maybe forget to push your changes? |
Unfortunately, I don't quite have them finished yet. I'm running into #48910 on my Mac which is hindering my progress. I do have a Linux box available which isn't running into the same issue but it's not as fast. Since we actually need to change the index type, |
You can use Good point regarding the type of the index. |
That's very helpful. Thanks!!
👍 👍 👍 👍
Yes, that's a great idea! I wasn't liking the |
@michaelwoerister Changes pushed |
Looking good now! Thanks! @bors r+ rollup |
📌 Commit c43b1a0 has been approved by |
…ister Convert SerializedDepGraph to be a struct-of-arrays Fixes rust-lang#47326 I did not try the "`mem::swap()` to avoid copying the arrays" idea because that would leave the DepGraph in an incorrect state and that doesn't seem like a good idea for me. r? @michaelwoerister
…ister Convert SerializedDepGraph to be a struct-of-arrays Fixes rust-lang#47326 I did not try the "`mem::swap()` to avoid copying the arrays" idea because that would leave the DepGraph in an incorrect state and that doesn't seem like a good idea for me. r? @michaelwoerister
[do not merge] Revert "Convert SerializedDepGraph to be a struct-of-arrays" Let's check if #49069 was actually helpful. r? @michaelwoerister
Fixes #47326
I did not try the "
mem::swap()
to avoid copying the arrays" idea because that would leave the DepGraph in an incorrect state and that doesn't seem like a good idea for me.r? @michaelwoerister