Don't do a full scan on first build #9931
Labels
A-build-scripts
Area: build.rs scripts
A-rebuild-detection
Area: rebuild detection and fingerprinting
E-hard
Experience: Hard
Performance
Gotta go fast!
S-triage
Status: This issue is waiting on initial triage.
During the first build with a build script (or running
cargo doc
) cargo does a full scan of the package to determine the file with the newest mtime. This full scan can be expensive and can cause some issues. For example, in #9545, there is no way to tell cargo to avoid scanning certain paths. This is also a lot of needless work, since for the purpose of determining if something needs to rebuild, during the first build it should know for certain that it needs to be built.This is difficult to fix because the fingerprinting code is fairly tricky and subtle. One idea I had was to add a new
FirstRun
variant toLocalFingerprint
that will be used if this is a build script that has never been run. TheLocalFingerprint
should then get adjusted to the correct value here. However, I vaguely recall trying this and running into problems.Fixing this for
cargo doc
isn't feasible unlessrustdoc
adds the ability to emit a dep-info file somehow.The text was updated successfully, but these errors were encountered: