6 ms·
The allocation fixes are scratching on the surface of the compiler. It must be something more fundamental underlying the long compilation time.
by kzrdude 10y ago
The allocation fixes are scratching on the surface of the compiler. It must be something more fundamental underlying the long compilation time.
- Manishearth 10y agoOne of the main slow bits is just LLVM. Rust produces LLVM IR which LLVM takes a long time to optimize. Since MIR has landed, IIRC work on doing MIR optimizations and LLVM IR simplifications is the next step here.
- kzrdude 10y agoRustc is of course responsible for what it's feeding llvm, and being smarter about that sounds exciting.
- gribbly 10y agoNot sure how much is due to this, but LLVM has gotten much slower in recent releases, probably due to improved optimizations. I would not be surprised if down the line, the Rust devs decided to write their own Rust backend rather than relying on LLVM.
- qznc 10y agoAt least for development a custom fast backend would be great. For production code you still want all the optimizations you can get, which means LLVM.
- wyldfire 10y agoWriting different backends for each supported target would either be taking on a lot of work or shedding some targets.
- coldtea 10y ago>Writing different backends for each supported target would either be taking on a lot of work or shedding some targets. Do any non statistical outliers care about non amd64 and ARM?
- soulbadguy 10y agoOpenPower,xeon phi for one; Even within the amd64 and arm families, there are enough variations (AArch vs qualcomm) and evolutions (SSE3 to SSE4) to make the task of developing a new and performant backend from scratch very resource consuming Also while taken individually most of the non amd64/arm platforms might not be significant, combine together they still represent a big share of the pie, doubly more so in the embedded world which rust (tries?) to target.
- coldtea 10y agoXeon yeah, haven't thought of that. For OpenPower, let IBM do it :)
- bzbarsky 10y agoFor a browser? 1/3 or more of desktop Windows users are on 32-bit Windows, last I checked. So you definitely care at least about ix86 of some form.
- wyldfire 10y agoWhat's a browser got to do with it?
- coldtea 10y agoI guess the parent thinks or implies that since Rust was created to help Mozilla build a next-gen rendering engine, platforms with browsers is the only domain they care about supporting.
- Manishearth 10y ago
- pjmlp 10y agoThat would be a good way for removing the C++ dependency on their toolchain, but it would take decades to achieve parity with the quality of LLVM optimisers and supported ISAs (which are a subset of gcc ones). C and C++ optimisers weren't that good in the 80 and 90's even against junior Assembly developers, the 40 years of compiler research in optimizing C and C++ code that made them what they are nowadays.
- gribbly 10y agoWhile I certainly agree that it would take time, I'm not so sure of 'decades' needed, I believe the scope of a Rust specific backend would be quite different from that of a everything-but-the-kitchen-sink backend like LLVM. Also not sure that reaching optimization parity with LLVM is an absolute necessity, Clang/LLVM is not as good at optimizing as GCC but that hasn't rendered it unpopular. Looking at Go as a benchmark, the compiler seems to be improving the optimization at a good pace and supports X86, ARM, PPC, MIPS, S390 despite being relatively young language and also having recently rewritten the compiler.
- pjmlp 10y agoGo still doesn't quite match what most Java native compilers are capable of. For that you need to use gccgo. The main problem with this kind of effort is mostly political, as many developers don't make a difference between language and implementation, thus making it harder for a language like Rust to win the hearts of its target audience, e.g. C developers that micro-optimize code as they write it.
- geodel 10y agoAre there benchmarks for those compilers? I ask because Go is quite competitive to Oracle JDK. http://benchmarksgame.alioth.debian.org/u64q/go.html http://benchmarksgame.alioth.debian.org/u64q/go.html
- pjmlp 10y agoYes, but usually Java compilers still tend to win when the benchmark is done in such a way that the 2nd level JIT is allowed to do its work. Go usually wins in those benchmarks, where Java code is either interpreted or still compiled with the 1st level JIT. And as mentioned, this is only relevant with the reference compiler, gccgo is much better.
- geodel 10y agoVery unlikely. Rust party line is optimization is critical, compile speed desirable.
- qznc 10y agoApart from the borrow checker there is nothing fundamentally different to other compilers. I doubt that borrow checking is fundamentally more expensive than other type checks. My guess is: Large compilation units and LLVM optimizations.