5 ms·
Perhaps 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
by vitalyd 11y ago
Perhaps 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.
- vitalyd 11y agoI'm aware of PackedObjects. Note it's not a value type in the sense it doesn't get allocated on the stack (if used as a local), it's a flattened object graph on heap with a shared header. More to the point, implementations are interesting to compare when they're for the same language, but not so much across languages as languages have different semantics and features that dictate how amenable they are to optimization with today's compilation techniques.
- pjmlp 11y agoI disagree. There is a good reason why we don't use e.g. Tiny C to discuss C performance vs other languages.
- vitalyd 11y agoMaybe I didn't make myself clear. If you want to compare speed cross lang, take fastest impl of each and compare that; so long as we're talking about real compilers existing today. Also, fundamentally C# and java aren't designed on zero-cost abstractions as core principle, which is fine in and of itself. Implementations try to recover performance but it's an uphill battle as compilers will always be limited by various constraints.
- pjmlp 11y ago> Maybe I didn't make myself clear. If you want to compare speed cross lang, take fastest impl of each and compare that; so long as we're talking about real compilers existing today. I agree. > Also, fundamentally C# and java aren't designed on zero-cost abstractions as core principle,.... Sure, but then again Ada, Delphi and D are also on my language list.
- steveklabnik 11y agoRust uses LLVM for codegen, which has had a _lot_ of time and resources poured into it.
- pjmlp 11y agoTrue, but having a good motor is not enough for having a good car. For example, apparently SIMD is only getting done on 1.3. Again, my whole argument goes against someone stating that Rust 1.2 compiler already generates better code than all the existing compilers for my language list, some of them with 20 years of production code. It is quite clear to me that Rust compiler will improve and take better advantage of LLVM. I just don't believe that 1.2 is already there.