Skip to content

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

@ehuss

Description

@ehuss

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-build-scriptsArea: build.rs scriptsA-rebuild-detectionArea: rebuild detection and fingerprintingE-hardExperience: HardPerformanceGotta go fast!S-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions