4 ms·
Often when building compilers you trade the speed of compilation against the speed of execution[1], and Rust has (traditionally) chosen the speed of executiong
by geewee 5y ago
Often when building compilers you trade the speed of compilation against the speed of execution[1], and Rust has (traditionally) chosen the speed of executiong over making the compiler fast.
This won't necessarily always be so, there's e.g. a new compiler backend called cranelift in the works, that makes compilations 30%ish faster, and in return the code isn't as optimized - which is good for a faster inner cycle.
https://pingcap.com/blog/rust-compilation-model-calamity#rusts-designs-for-poor-compilation-time https://pingcap.com/blog/rust-compilation-model-calamity#rus...
- saurik 5y agoThe biggest issue cited in this article is a regression in the type checker, which is an open bug that apparently is just lower priority than whatever else the Rust team is working on instead of ensuring compilation time is fast. Only once that was worked around did they article really start having to pay attention to the code generation and linking stages, and the issues there seem to mostly be about lack of parallelism caused by the "crates" model combined with link time optimizations and incremental compiles being off by default. You don't need to make a fundamentally faster code generator that makes worse output to deal with this: the performance losses you get from parallel, incremental, and separate compilation techniques are so minimal that only the most serious C++ projects go out of their way to combine translation units and activate LTO.
- Ar-Curunir 5y agoContrary to what you say, rust compilation speed is a top priority for rustc developers. Rust compiler times have gone down YoY every year for the past few years. See, eg, https://nnethercote.github.io/2021/11/12/the-rust-compiler-has-gotten-faster-again.html https://nnethercote.github.io/2021/11/12/the-rust-compiler-h...
- pdimitar 5y agoThen this means that the developer ecosystem continuously finds ways to swallow the improvements in speed. :(
- mickeyp 5y agoI'm not disagreeing, but I could cold compile a million lines of Delphi code in a few minutes on a crappy laptop more than a decade ago. Delphi managed to be both fast to compile and a fast language; of course, it's not as sophisticated or complex a language as C++ or Rust. But still...
- ModernMech 5y agoThe third axis in compiler development is safety. The compiler writer’s dilemma can be framed as: fast execution, safe execution, fast compilation — choose 2.
- mamcx 5y agoADA. This is a false(ish) dilema. The problem of Rust is that is made with a C++ mindset. Is VERY hard to make compiler fast if it follow what C/C++ do (Go is the only evidence against!). Is a death by thousands cut. The syntax is the FIRST and big one. How you chose it will impact all the pipeline. Then the rest...
- pyjarrett 5y agoAda isn't entirely safe. It does avoid C-string issues using length-based strings, bounds-checking array access and other features like access types instead of pointers, but it is still possible to hold onto an access to dynamically allocated memory after deletion (though you can somewhat mitigate this with smart pointers).
- mamcx 5y agoSure, neither Rust. But the things that make Rust safe are not that much slower. Macros, Generics, all that syntax, all that lang complexity (ie: Not just the semantics but the way is surfaced) have a bigger impact.
- estebank 5y agoSyntax parsing is nowhere close to the critical path for Rust, and I suspect there are no languages where it is today.