Compile crates as they are downloaded.
Not sure if this is possible or not. It looks like Cargo currently waits for all crates to be downloaded before beginning compilation, which means the CPU is idling in the meantime.
If the crates were compiled in the background as they are downloaded, it should mean faster project builds.
Will this be accepted if it gets worked on?
This is a large feature, as it will complicate the cargo internals. One difficulty is that you need to identify which crate to get started first. The information is generally available in crates.io index files.
If not going through with an RFC, I would at least expect to see a clear design proposal of how it organizes the codebase before the cargo team signs off and accepts the work.
This seems like a large amount of work but how much will it benefit people?
- Biggest gains are on completely fresh systems. Yes, this might sometimes be CI but people tend to configure CI to use caching and we should be working to find ways to maximize that cache usage
- Next biggest gains are for when switching to a project that is completely different than other stuff you are working on
- You might get some benefit when doing dependency upgrades
Rebuilding the same project over and over again is the most likely scenario and it won't help there.
Granted, I have a fairly good internet connection and this would likely benefit people with worse connections to crates.io.
I agree with your assessment. I raised this issue quite a long time ago without any ideas how it could actually be implemented.
The speedup would only be for clean builds, although it could still be substantial.
Maybe there are lower hanging fruit for speeding up Cargo builds.
Also, this is blocked on #15834.