2 ms·
> I don't know what techniques are used by Rust to speed up compilation. From what I've observed, forcing the developers to compile the language using itself i
by kibwen 15y ago
> I don't know what techniques are used by Rust to speed up compilation.
From what I've observed, forcing the developers to compile the language using itself is a great way to keep the programmers mindful of compilation speed. :)
In Rust's case, I believe the bottleneck is LLVM. You can disable optimization if you just care about fast turnaround times, but you're always at the mercy of LLVM to do the actual code generation. To that end, the Rust devs have recently begun an initiative to profile the amount of LLVM IR that they generate in the compiler, and they've made some good strides so far just from picking the low-hanging fruit.
As far as comparisons to other languages go, I'm not sure if Rust's compilation model is set up to be as fast as Go's, although (IIRC) Rust avoids the template-generation step that bogs down C++.
- pcwalton 15y agoWe'll never be as fast as Go in compile speed: just to name a few issues, we do flow analysis (so we check whether your variables are initialized before you use them), our typechecking proceeds by unification (so you can say stuff like [] and the typechecker will figure out what the type of that empty vector is), and we have an extra IR-generating step (so we can take advantage of LLVM optimizations). It's a question of different goals; one of Go's primary goals was to compile quickly (which is a fine goal!), which isn't one of the goals of Rust (although we definitely want to compile fast, of course, and we have continuous integration benchmarks to that effect).