-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Loading of a git source is slow due to always checking if the submodule is updated #14603
Comments
When we cargo/src/cargo/sources/git/utils.rs Lines 174 to 185 in 9d66d13
We then unconditionally check for submodules cargo/src/cargo/sources/git/utils.rs Line 186 in 9d66d13
submoduels should be as immutable as the checkout and we should be able to guard the whole process with the freshness check. The main risk in doing that is if you switch back and forth between old cargo and Cargo with the submodules covered by the freshness check and the submodule update is interrupted. New cargo will see that the freshness check passxes and assumes the submodule is valid and goes on its way. We could do extra fancy things with the file used for this like in #14395 but it doesn't seem worth it. |
CC @osiewicz |
It seems like old cargo will "heal" itself from the corrupted checkout, as it'll remove it and refetch everything. Given that, I would agree that we could just proceed as is? Alternatively, could we bundle submodule freshness check with the checkout freshness check? |
The corner case is
This kind of quick back and forth is likely when working directly with Cargo and an IDE running Cargo in the background. That said, I think we would be fine with this. This will be limited to a specific set of cargo versions run in a specific order, with an interruption. Over time, the combination of versions will become less likely. If we did something else about this, some potential mitigations
|
When you have some git dependencies or patches, loading them takes a long time
For the traces from #14238, notice how slow the first
resolve
is compared to the second. A lot of the time is taken up checking each git dependencies submodulesNote: this slow down is most relevant for tooling like
rust-analyzer
or rust-defined completions when it may be called in interactive contexts without any compilation happening or "cargo script" wherecargo build
is performed every time you run your script.Related: #14395
The text was updated successfully, but these errors were encountered: