4 ms·
I agree. Hopefully when the Cranelift backend works it will get a lot faster, but even `cargo check` can be pretty slow, and I'm not sure if there is any way ar
by IshKebab 6y ago
I agree. Hopefully when the Cranelift backend works it will get a lot faster, but even `cargo check` can be pretty slow, and I'm not sure if there is any way around it.
One idea I had: can crates.io generate machine independent Rust IR for all of the crates and have cargo download it? Then at least you don't need to parse/check/compile the source code of dependencies for clean builds.
Probably wouldn't work for any crates that use `build.rs` or conditional compilation anywhere though (which is probably most of them).
- hobofan 6y agoApart from the conditional compilation problems, you would also have to pre-compile for all different Rust versions. Given the size of a typical `target` directory the artifacts for just a single Rust version will also probably be ~10x as big as the current crate source.
- IshKebab 6y agoMmm good point. An ideal solution for CI would be something like sccache, but I think to get that to work reliably you need to consider it from the beginning (like Bazel did) and Rust just didn't. `build.rs` can do literally anything. Proc macros can do anything. Even a simple `include_str!()` can break distributed compilation. It would be great if Cargo had a "hermetic" mode where you couldn't use `build.rs` and proc macros couldn't do any IO, etc.
- onei 6y agoIt's an interesting idea, and one python has sort of used for a while with wheels (pre-compiled binary packages for specific architecture/OS combinations). For Rust, they could potentially cache the MIR or even a higher level LLVM IR, but perhaps those formats are too unstable or end up extremely complicated.
- volta83 6y agoas long as you are not switching compilers during development, those formats are stable..