4 ms·
I love new languages (unlike a lot of HN, I'm excited about Rust AND Go), but please remember that C/C++ compilers have been around, sometimes for more than 30
by joaodlf 10y ago
I love new languages (unlike a lot of HN, I'm excited about Rust AND Go), but please remember that C/C++ compilers have been around, sometimes for more than 30 years. Do not think new compilers will just waltz in and suddenly topple all this previous work - That will be a long march.
- adamnemecek 10y ago> unlike a lot of HN, I'm excited about Rust AND Go If there is one thing there isn't enough of on hn, it's discussions about Go
- kibwen 10y agoRust uses LLVM, which is a backend developed with C and C++ in mind that has been under development for a bit over a decade now. As long as you basically pretend to be C++ at a low level (which Rust does), then the two remaining factors to consider are optimizations that happen in the front end and language-level semantics that enable language-dependent optimizations. (We should also consider that LLVM isn't as venerable as GCC, but it seems that (for C and C++ code) there's no longer any clearly superior choice between the two wrt general-purpose code generation (would be happy to hear arguments to the contrary)).
- Manishearth 10y agoAlias analysis has been the holy grail of compiler development for a while. In C++ it's a global, imperfect, and expensive analysis. In Rust you get it for free. C++ can't do the same thing Rust does because it would be a breaking change to have finer-grained distinctions between the types of references. This is a matter of language semantics, not compiler implementation. rustc isn't doing anything new here, LLVM already knows how to make this optimization and is making it.
- tmccrmck 10y agoWhat specifically makes you think alias analysis is the holy grail of compiler optimization?
- Manishearth 10y agoI spent some time studying the subject a few years ago. Most of the current efforts I saw were about improving alias analysis. Could have been a skewed view of the thing, but the researchers I talked to seemed to feel like it was. Some compiler devs I've talked to do too. In general it does unlock a lot of opportunities when it comes to optimization.