4 ms·
Rust is faster than most of the languages you listed and has some nice language semantics e.g. generics. Why should we use Go when more mature alternatives exi
by threeseed 11y ago
Rust is faster than most of the languages you listed and has some nice language semantics e.g. generics.
Why should we use Go when more mature alternatives exist ?
- pjmlp 11y agoExcept for Go, all the languages I listed have support for generics. I doubt Rust is faster than the languages I listed. Assuming a comparison with all available compilers, not just open source ones. I only had Go in the list, because it also compiles to native code and has support for web on its standard library. And it is a good alternative to C for anything that touches the network.
- pcwalton 11y agoWhy do you think other languages will optimize as well as Rust? Specifically, how do you propose to get the same level of memory alias analysis with unrestricted aliasing and mutation? How do you propose to deal with escape analysis for higher-order functions without a region/lifetime system?
- pjmlp 11y agoYears of effort put into their compiler optimizers. For example, without any benchmarks I wonder how Rust current code generation relates to optimizing Ada compilers, specially the commercial ones like Atego. It is hard to believe a language with an 8 year old compiler already generates better code than a 20 year old compiler battle tested in many production systems, even with the help of LLVM as backend.
- pcwalton 11y agoI think there's no way we're going to know either way in terms of the current state of the art. I do think, however, that Rust has language advantages that will enable better optimization going forward than languages with unrestricted (or less restricted) aliasing and mutation.
- pjmlp 11y agoI agree Rust will get better, but the comment I has replying to was about code quality today.
- vitalyd 11y agoPerhaps you're discounting the importance of LLVM and at the same time overestimating performance of some of the languages you mentioned. .NET: type system has some performance oriented features, but JIT compiler isn't all that great (currently). Java: java has terrible performance model but JVM does heavy lifting to recover a good amount. However, there are still problems once your perf targets get tighter and tighter (ergonomics also degrade the more you push performance).
- pjmlp 11y agoI am not overestimating the othe languages, because unlike many HNers I differentiate between languages and implementations. Just to pick on your example, for Java there is OpenJDK, Oracle's commercial JDK, IBM J9, Excelsior JET, HP-UX JDK and many many other compilers. The new .NET compiler makes use of the Visual C++ backend, as another example. Ada compilers have around 20 years history of production code. Same goes for some of the other languages. So when one bluntly states that Rust 1.2 compiler already generates faster code than any of the compilers for the other languages, including commercial ones, it is a bit hard to believe. Of course Rust's compiler will improve code generation.
- vitalyd 11y agoLanguage vs implementation is Sufficiently Smart Compiler phrased differently. The main difference between Rust (and say C++) and .NET/Java is the former has a stronger performance model baked into the language which makes it easier to make an implementation fast.
- pjmlp 11y agoHowever not all implementations are made alike. For example, when one speaks about Java, are you aware that IBM's J9 compiler supports value types via the packed objects extension? Or that Mono cannot compete with Visual C++'s backend for .NET native code generation? Or that any commercial Common Lisp runs circles around the open source offerings? So speaking of language X, always matters to refer to implementations.