News for hackers. Stuff that matters.
Re:Rust in 2016 by tomp on Friday August 14, 2015 @03:03PM (#10062112)
IIRC, you usually claim that the majority of the compilation time is actually LLVM optimizations, not Rust typechecking. If that's true, it should be trivial to simply turn off LLVM optimization passes for DEV builds.
Re:Rust in 2016 by pcwalton on Friday August 14, 2015 @03:13PM (#10062195)
Sure, turning off LLVM optimization passes helps a lot, usually speeding up the compile by more than 2x. Though note:

1. There are some technical issues in LLVM that prevent Rust's -O0 from being truly -O0 (LLVM's FastISel not supporting the invoke instruction being the main one here).

2. Go's compiler doesn't have much of an optimization IR at all. From what I understand, it compiles straight from the AST to Plan 9 assembly. The equivalent in Rust would be a backend that went straight from the AST to LLVM MachineInstrs (like the Baseline JIT in SpiderMonkey). Such a backend would be the ideal way to get fast whole-program compilation but would be a non-starter for optimization, so nobody has focused on it given how much work it would be. Incremental compilation would be a better use of people's time than maintaining an alternate backend, because only incremental compilation gives you algorithmic speedups (O(size of your crate) → O(size of the functions that changed since your last rebuild)).

It still takes longer to compile Rust code than many people would like. That's why it's being worked on.

Re:Rust in 2016 by arielby on Friday August 14, 2015 @05:57PM (#10063222)
When the MIR work is done creating a new translator would certainly be easier.
Re:Rust in 2016 by steveklabnik on Friday August 14, 2015 @03:15PM (#10062200)
At -O0, Rust is _very_ slow. It's a common meme that people jump into IRC or the users' forum and say "Why is this Rust code slower than Ruby?" Considering Rust is often chosen specifically for performance, sometimes, this makes your application not usable.