-
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
[parallel-queries] Make CrateMetadata::cnum_map immutable #50502
Comments
It seems that |
@rleungx Oh, you are right of course. In that case, I'll remove the |
#50532 implements a partial solution. We still have a lock, but its around data that is accessed a lot less. |
… r=Zoxc Don't use Lock for heavily accessed CrateMetadata::cnum_map. The `cnum_map` in `CrateMetadata` is used for two things: 1. to map `CrateNums` between crates (used a lot during decoding) 2. to construct the (reverse) post order of the crate graph For the second case, we need to modify the map after the fact, which is why the map is wrapped in a `Lock`. This is bad for the first case, which does not need the modification and does lots of small reads from the map. This PR splits case (2) out into a separate `dependencies` field. This allows to make the `cnum_map` immutable (and shifts the interior mutability to a less busy data structure). Fixes rust-lang#50502 r? @Zoxc
… r=Zoxc Don't use Lock for heavily accessed CrateMetadata::cnum_map. The `cnum_map` in `CrateMetadata` is used for two things: 1. to map `CrateNums` between crates (used a lot during decoding) 2. to construct the (reverse) post order of the crate graph For the second case, we need to modify the map after the fact, which is why the map is wrapped in a `Lock`. This is bad for the first case, which does not need the modification and does lots of small reads from the map. This PR splits case (2) out into a separate `dependencies` field. This allows to make the `cnum_map` immutable (and shifts the interior mutability to a less busy data structure). Fixes rust-lang#50502 r? @Zoxc
Is this still a partial solution?
…On Thu, May 10, 2018, 10:04 PM bors ***@***.***> wrote:
Closed #50502 <#50502> via #50532
<#50532>.
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
<#50502 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAyu2OScGgVW0_UzuzJmTDaTQ2CSNRt4ks5txPGkgaJpZM4T1EXS>
.
|
It's partial (because it does not reduce the amount of shared mutable state) but it addresses my main concern by not requiring to keep the Removing more mutable state from |
The CrateMetadata::cnum_map field is wrapped in a
Lock
but it does not seem to be mutated anywhere. Less mutable state is always better. To solve this task, remove theLock
and make things compile again.cc @rust-lang/wg-compiler-performance
The text was updated successfully, but these errors were encountered: