News for hackers. Stuff that matters.
Re:How to speed up the Rust compiler some more in 2020 by MaxBarraclough on Wednesday August 05, 2020 @07:07AM (#24059399)
No mention of the work being done on the CraneLift backend for Rust. [0] That seems like a great solution: have one compiler that runs quickly, for development, and have a different compiler for release builds, capable of state-of-the-art optimisation.

My understanding is that compile times can be greatly improved simply by using a faster (and less optimising) code-generator, even without doing the (presumably much harder) work of optimising Rust's borrower-checker.

Disclaimer: I don't know all that much about Rust.

[0] https://github.com/bjorn3/rustc_codegen_cranelift

Re:How to speed up the Rust compiler some more in 2020 by Thaxll on Wednesday August 05, 2020 @10:14AM (#24060966)
Having two different compiler is tricky because that means what you dev and what goes to prod are different?
Re:How to speed up the Rust compiler some more in 2020 by MaxBarraclough on Wednesday August 05, 2020 @12:51PM (#24062901)
Could be an issue, but it's one with various possible solutions. Devs could switch to the LLVM-backed compiler periodically, a continuous integration system could run both compilers, etc.

If both compilers are relatively bug-free it shouldn't be too much of a burden. Correct C/C++ code runs fine under both GCC and Clang, for example. If anything, things should be easier with Rust, as it gives you less opportunity to shoot yourself in the foot in strange compiler-specific ways than do C and C++. I recall having a C++ alignment issue that only arose in one compiler, for example. (Of course, my code was broken, but it worked ok with one of the compilers just 'by coincidence'.) I figure that kind of thing is less likely in Rust, but I don't know the Rust language well enough to say this with confidence.

Re:How to speed up the Rust compiler some more in 2020 by tonyedgecombe on Wednesday August 05, 2020 @10:44AM (#24061339)
That’s the case with other compiled languages as the debug and release builds have different optimisations.
Re:How to speed up the Rust compiler some more in 2020 by edflsafoiewq on Wednesday August 05, 2020 @08:36AM (#24060112)
My impression was cranelift doesn't improve compile time by enough to lift rustc out of the "slow" category, and borrowck isn't usually the expensive part of compilation.
Re:How to speed up the Rust compiler some more in 2020 by MaxBarraclough on Wednesday August 05, 2020 @08:50AM (#24060224)
If not the borrower-checker or the code-generator, what's the slow part of Rust compilation? The front-end?
Re:How to speed up the Rust compiler some more in 2020 by trait on Wednesday August 05, 2020 @09:27AM (#24060509)
The slowest part is code-gen indeed, that's why cargo-check[0] is really fast. [0]https://doc.rust-lang.org/cargo/commands/cargo-check.html
Re:How to speed up the Rust compiler some more in 2020 by zozbot234 on Wednesday August 05, 2020 @10:15AM (#24060981)
Typically the bottleneck is monomorphizing generic code. Also evaluating macros (if they're being used).