3 ms·
Rust doesn't have to be much slower but when your compiler has three IRs to go through it doesn't help. D is a pretty complex language, but it's explicitly des
by mhh__ 6y ago
Rust doesn't have to be much slower but when your compiler has three IRs to go through it doesn't help.
D is a pretty complex language, but it's explicitly designed around compile times in many locations.
Changing the basic implementation of language features probably won't help a huge amount, you could probably get a lot back with a simple backend that does no optimisations other than register allocation. (The main D compiler can do more than this but it lags behind LLVM by quite a way so it's not useful for fast code)
- alex7o 6y agoD can, be a good language to compare compile time speeds, as it has LDC(LLVM D compiler), GDC(GCC D compiler) and the official compiler optimised for speed. This way we can see how much overhead stuff like llvm add. And how much the perf is better.
- deleted 6y ago[deleted]
- steveklabnik 6y agoThree IRs can actually help; it's not that simple. For example, https://blog.rust-lang.org/inside-rust/2019/12/02/const-prop-on-by-default.html https://blog.rust-lang.org/inside-rust/2019/12/02/const-prop... is an example of performing an optimization on an earlier IR, which gives you a 2%-10% speed boost. > Even though LLVM has its own constant propagation pass, we see improvements because our pass operates on MIR while it is still generic. The more concrete instances of a generic function that are instantiated, the larger the payoff from this optimization. It can be counter-intuitive, but it just really depends on the details. Of course, a single pass compiler will be faster to compile than a more complicated one, but it's not as straightforward as "more IRs == slower."
- mhh__ 6y agoMy point was more along the lines of the language is sufficiently complex to lose the bigger picture when it comes to compile time speed rather than that the compiler is definitely slower due to said IRs.