by ReleaseCandidat · 4y ago · 0 comments
But it _is_ slow. Same as C++ and Haskell compilers are slow. And you cannot get it to really compile faster - like OCaml speed - because the language (macros and traits I guess are the worst) prohibits that. Of course, if all somebody knows are C++, Haskell and Rust the compilation doesn't seem slow to them.
This is a common assumption but I've rarely see cargo check, which both expands macros and solves traits as well as runs the borrow checker take more than a few seconds on my machine, even when full compilation takes minutes. Most of the slowness is really in the parts that come afterwards, I suspect especially once you hit the generics explosion in later passes.
Microsoft packages a full set of binary libraries with a build.rs script for Rust/WinRT, otherwise no one would bother to wait for the build.
https://github.com/microsoft/windows-rs/tree/master/.windows
Also seeing the same crate consumed in multiple version being compiled multiple times isn't fun.
For example, the image crate.
So while most of the compile time is indeed usually in LLVM, there are still a lot of things rustc can do to give LLVM an easier time.