-
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
Load the dep graph before parsing #115693
Conversation
// Create a hash for metadata and the rust version | ||
let metadata_and_version = StableCrateId::new( | ||
symbol::kw::Empty, | ||
false, |
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.
Always specifying false here will cause the incr comp cache for libs and bins with the same crate name to conflict. This argument exists to avoid this conflict.
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.
I guess we can support that if the crate types are specified on the command line.
bf9c899
to
8ca0263
Compare
This comment has been minimized.
This comment has been minimized.
8ca0263
to
360ee87
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Load the dep graph before parsing This changes the dep graph to start loading before parsing. We don't have access to the crate name defined in the source code at this point, so if it's not specified on the command line, incremental compilation will fallback to the file path as a crate identifier. r? `@oli-obk`
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (bcdfb0b): comparison URL. Overall result: ❌ regressions - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 627.323s -> 628.994s (0.27%) |
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.
why are we using the crate name as part of the stable crate id at all if there are workarounds that don't need them? Or similarly for crate_types
// Use the crate name from the command line if available and valid | ||
let crate_name = sess.opts.crate_name.as_ref().and_then(|name| { | ||
name.as_str().chars().all(|c| c.is_alphanumeric() || c == '_').then_some(&name[..]) | ||
}); |
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.
does this duplicate some logic from somewhere?
We should probably ensure they stay in sync (ideally by deduplicating, maybe via a Sess
method?)
I'm not really sure about the possible effects this PR can have. I guess the core part is that the stable crate id is entirely independent of the crate source. This should probably go through an MCP as there has gone a lot of discussion and design into the current behaviour, and we should not just change without larger feedback. I think something in this direction is ok, but I also think it needs a larger refactoring of |
The primary negative effect would be reusing incremental artifacts from the wrong crate which slows down compilation due to them having to be copied on disk, load to memory and discarded. I'm not a huge fan of including file names as crate identity here. There could be some issues with shifting paths (shared folders, renaming, etc.). My preferred semantics would be having I don't know how |
I'll take @oli-obk suggestion in this comment and label this PR as needing an MCP. Please @Zoxc feel free to provide more context (I may be missing some bits), thanks @rustbot author |
Closing in favor of #121764. |
This changes the dep graph to start loading before parsing. We don't have access to the crate name defined in the source code at this point, so if it's not specified on the command line, incremental compilation will fallback to the file path as a crate identifier.
r? @oli-obk