Problem
Currently when updating a leaf dependency all crates that depend on it are rebuilt (both directly and transitively).
This means that a simple dependency bump can force large part of the dependency tree to recompile when it otherwise wouldn't need to.
Proposed Solution
Build systems like Bazel only rebuild a unit if the of tasks inputs have changed.
This is known as "Early Cutoff". 1
This differs from Cargo's implementation in that the dependencies for a build unit are the dependents outputs.
Cargo only uses the inputs of dependency units, so if the output (rlib) does not change it still rebuilds dependent units.
The proposed solution is to modify Cargo's fingerprinting system to use build unit outputs (instead of inputs) when determining a units fingerprint. Avoiding rebuilds of the inputs of a previous build unit did not changes it output.
Notes
This may be a good opportunity to re-evaluate at a high level how fingerprinting works in cargo in general
Problem
Currently when updating a leaf dependency all crates that depend on it are rebuilt (both directly and transitively).
This means that a simple dependency bump can force large part of the dependency tree to recompile when it otherwise wouldn't need to.
Proposed Solution
Build systems like Bazel only rebuild a unit if the of tasks inputs have changed.
This is known as "Early Cutoff". 1
This differs from Cargo's implementation in that the dependencies for a build unit are the dependents outputs.
Cargo only uses the inputs of dependency units, so if the output (rlib) does not change it still rebuilds dependent units.
The proposed solution is to modify Cargo's fingerprinting system to use build unit outputs (instead of inputs) when determining a units fingerprint. Avoiding rebuilds of the inputs of a previous build unit did not changes it output.
Notes
This may be a good opportunity to re-evaluate at a high level how fingerprinting works in cargo in general
Footnotes
Mentioned in Build systems à la carte. I don't know the origin. ↩