Open epage opened 1 month ago
The core problem is that git sources are indexed by name. To find a name, we walk the source to find all Cargo.toml
files except if they are in a submodule or a hidden directory except if a Cargo.toml
has a path dependency in it in an ignored location.
Without that second exception, we could parse Cargo.toml
to toml::Table
, look up the name, and be done. That would cut out probably 60% of the manifest parsing performance hit.
With the second exception, we have to do a full parse of the Cargo.toml
file.
Ideas
dependencies
to specify the path within the repo (#11858)
Cargo.lock
Cargo.lock
to the source to be use.cargo-ok
.cargoignmore
file in the repo for what not to index (requires opt-in by the dependency)Cargo.toml
s in a faster format (likely cut 1/6 of parse time out)Main risk: there aren't enough manifests for us to skip loading
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. Almost all of that is taken up in Manifest parsingNote: 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.Related: #13724