But... this is true. The design of the language is biased to make slow compiling across the full pipeline.
Is possible to get into a shout contest about this :), so just look at what Pascal(Delphi) do and how absurdly fast it is, despite the fact is still a "batch compiler".
So in the presence of pascal (that is even more complex than Go, to be a really close to C/C++ in capabilities) is clear that Rust is MADE to be slow.
And to the point, I used more than +12 languages already, super popular things like this:
https://endler.dev/2020/rust-compile-times/
NOT exist for Delphi. The "how make delphi compile fast" is to just use delphi. It will compile fast.
In other words the Rust language design (as opposed to the compiler implementation) was not the bottleneck in the compilation time; the factors were well-known issues of the Rust compiler implementation: 1. it relies on LLVM, which is slow 2. it generates slow to compile IR code.
Is like the people on the C-like languages (with the exception of Go) can't resits the temptation of make languages slow to use (yet, spend absurd amount of time on produce good binaries).
Is not that I not grateful of how good Rust/LLVM compiled binaries perform, in fact, is one of the big reasons I use Rust! but is kind of weird(?)/funny(?) that the languages itself are so slow.
I think is cultural. People on that side of the fence are so used to use sub-optimal tooling that don't mind too much to use another tool on the same feels. And if it provide "10%" increase on performance, get so happy, because is against the old, not agains the best.
This is false. There is the Rust Cranelift backend in development, which is actually usable already (depending on the project). Having a fast compiler for debug builds and a slow one for release ones is a setup that I can imagine being the future of Rust.
I've just built a project of mine and it took exactly half of the time to compile, when compared to the standard compiler.
It's actually crazy that they're even developing a JIT (although it requires dynamic libraries as dependencies, so its usage is and possibly will be limited).
The original one in Gtkmm, takes around 5 minutes in release mode, if that much.
Another pro tip, switch to llvm linker.
Here is the thing with pro tips, maybe just maybe, I am an avid reader of Nicholas blog posts and know them all already.
I can't test on an old machine, but modifying the project code and performing an incremental (standard) build, takes around 5 seconds on a modern machine.
Yes
> which are not really representative of a daily workflow.
Only on Rust :). This is a "hack" that must be done to make Rust viable. In Delphi, a full compile is so fast that it's pointless to make it incremental.
So imagine being on the waiting lobby of an airport, reading about a cool Rust project and then trying to check it on your laptop. With luck it is finished compiling before being called for boarding.
Either that, or: it asks exactly that question rather than assumes that slow compilation is intrinsic to memory safety etc. But yes, there might be an implicit premise about some part of the Rust design contributing to slow compilation times.
- LLVM_module_codegen_emit_obj: 47% of the time - LLVM_passes: 16% - codegen_module: 15%
Sample of Rust-specific passes:
- MIR_borrow_checking: 0.2% - resolve_lifetimes: 0.0%
The two passes above are arbitrarily picked, but anything other than the top three takes cumulatively 22% of the time.
Based on this, the Rust IR generation and LLVM are the bottleneck. I'd be interested in the opinion of somebody knowledgeable, since there may be non-obvious mistakes in the above reasoning.
There are a few interesting reasons why Rust compilation time is slow and Go's is fast. Here's a summary of the first: https://pingcap.com/blog/reasons-rust-compiles-slowly.
In theory, with enough time and resources, Rust could see an efficient compiler, but this is something that can't be predicted, as it depends on its future success, or, to be clear, the backing it will have.
In practice, the Rust Cranelift backend could provide enough speed (for debug builds) that compilation times won't be slow anymore.
Something to consider is also that compilation is a tradeoff between compiling speed and runtime speed (Golang's favoring compiling speed), so one can't have both ends of the the spectrum at the same time.