Skip to content
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

Don't do a full scan on first build #9931

Open
ehuss opened this issue Sep 21, 2021 · 0 comments
Open

Don't do a full scan on first build #9931

ehuss opened this issue Sep 21, 2021 · 0 comments
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.

Comments

@ehuss
Copy link
Contributor

ehuss commented Sep 21, 2021

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 to LocalFingerprint that will be used if this is a build script that has never been run. The LocalFingerprint 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 unless rustdoc adds the ability to emit a dep-info file somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

2 participants