Re:Improving Rust compile times to enable adoption of memory...
by dwattttt on Friday February 03, 2023 @07:16AM
(#34640119)
Refreshing the crates index has gotten quite slow because it currently downloads the entire index, regardless of which bits you need. There's a trial of a new protocol happening now, due for release in March, that should speed this up (https://blog.rust-lang.org/inside-rust/2023/01/30/cargo-spar...)
Re:Improving Rust compile times to enable adoption of memory...
by zozbot234 on Friday February 03, 2023 @07:18AM
(#34640142)
You don't even need a separate language, there's already a "fast" compiler for Rust based on cranelift which is used in debug builds by default.
Re:Improving Rust compile times to enable adoption of memory...
by burntsushi on Friday February 03, 2023 @07:47AM
(#34640366)
Cranelift is not used for debug builds by default. I think that's probably a goal (although I'm not actually 100% sure about that just because I'm not dialed into what the compiler team is doing). Even the OP mentions this:
> We were able to benchmark bjorn3's cranelift codegen backend on full crates as well as on the build dependencies specifically (since they're also built for cargo check builds, and are always built without optimizations): there were no issues, and it performed impressively. It's well on its way to becoming a viable alternative to the LLVM backend for debug builds.
And the Cranelift codegen backend itself is also clear about it not being ready yet: https://github.com/bjorn3/rustc_codegen_cranelift
(To be clear, I am super excited about using Cranelift for debug builds. I just want to clarify that it isn't actually used by default yet.)
Re:Improving Rust compile times to enable adoption of memory...
by nicoburns on Friday February 03, 2023 @09:00AM
(#34641121)
The more immediate goal of "distribute the cranelift backend as a rustup component" has been making good progress and seems like it might happen relatively soon https://github.com/bjorn3/rustc_codegen_cranelift/milestone/...
Re:Improving Rust compile times to enable adoption of memory...
by burntsushi on Friday February 03, 2023 @09:06AM
(#34641178)
That's amazing. Thanks for that update. Can't wait.
FWIW cold builds (i.e., in docker with no cache) of cargo are much slower than go, hanging for a long time on refreshing cargo.io indexes. I don't know exactly what that is doing but I have a feeling it is implemented in a monolithic way rather than on-demand. Rust has had plenty of time to make this better but it is still very slow for cold cargo builds, often spending minutes refreshing the crates index. But Go misses easy optimizations like creating strings from a byte slice.
So it is what it is - Go makes explicit promises of fast compile times. Thanks to that, build scripts in go are pretty fast. Any language that doesn't make that explicit might be slow to compile and might run fast - that's totally fine and I would rather have two languages optimized to each case than one mediocre language.