5 ms·
I really appreciate the rate of optimizations going on in .NET, I feel like openjdk focus less on optimizing codegen and intrinsics (although it does it well co
by SemanticStrengh 4y ago
I really appreciate the rate of optimizations going on in .NET, I feel like openjdk focus less on optimizing codegen and intrinsics (although it does it well compared to other languages).
I even speculate C# will reach a point where it will be faster than real world C++ code in many cases. One reason being that GCC/LLVM have mostly stalled performance wise, with only ~1% increment per years (except in very specific cases), and the JIT model should be superior IMHO, I don't understand why JITs can't have a long AOT passe just like LLVM and switch to runtime JIT opts/deopts only if it is superior. This will happen, the question is when?
- mbrodersen 4y ago> I even speculate C# will reach a point where it will be faster than real world C++ code in many cases Don’t hold your breath. The Java community has been trying to do that forever and no cigar. C/C++ is still the #1 language for high-performance software. Developers who hasn’t worked on high-performance software always underestimate how hard it is to compete with C/C++ when it comes to raw performance. Which is why new high-performance projects are started every day using C/C++.
- SemanticStrengh 4y agoIt depends https://news.ycombinator.com/item?id=25217270 https://news.ycombinator.com/item?id=25217270
- mbrodersen 4y agoJava is only as fast as C/C++ if you completely avoid creating objects. It is the ability to manipulate raw data in a cache optimum way and without the Java/C#/… imposed overhead that makes C/C++ fast. Trading doesn’t touch much data so I am not surprised that Java is OK there.
- pjmlp 4y ago.NET still has some catch up to do with JVM eco-system (there is more than OpenJDK out there) in tiered compilation, JIT caches, automatic vectorization (Intel contributed AVX support), devirtualization. It already happened, that is what JIT caches with PGO feedback are all about, available out of the box in Android (yeah I know it isn't really Java), OpenJDK since version 9, OpenJ9 since ages, and on commercial JDKs like PTC, Jamaica, J/Rockit, since begining of the century. .NET introduced PGO feedback around .NET Framework 4.6, but until now it has been quite hard to make use of, and there are some improvements coming up on .NET 7 to make it more automatic without the need to explicitly call some runtime APIs.
- DeathArrow 4y ago>tiered compilation .NET has tiered compilation. https://docs.microsoft.com/en-us/dotnet/core/runtime-config/compilation https://docs.microsoft.com/en-us/dotnet/core/runtime-config/... >JIT caches .NET has a native image cache. https://docs.microsoft.com/en-us/dotnet/standard/managed-execution-process https://docs.microsoft.com/en-us/dotnet/standard/managed-exe... >automatic vectorization NET has automatic vectorization. https://docs.microsoft.com/en-us/cpp/parallel/auto-parallelization-and-auto-vectorization?view=msvc-170 https://docs.microsoft.com/en-us/cpp/parallel/auto-paralleli... >devirtualization .NET suports both inlining and devirtualization. https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-6/ https://devblogs.microsoft.com/dotnet/performance-improvemen... So, basically, none of the downsides you think about exist.
- pjmlp 4y agoI have been doing Java and .NET since they exist, .NET even before it was launched thanks to working for a Microsoft Partner that was part of the launch event in Portugal, which gave us access to early builds, the famous MSDN discs with documentation written in red. Maybe I do know one thing or two about what .NET is lacking versus Java in JIT/AOT department.
- deleted 4y ago[deleted]
- redox99 4y agoThe hypothesis that JIT can be faster than C/C++ because it can adapt code during runtime is mostly nullified by PGO. Yes, you could argue that in some programs the execution path might drastically vary and the profile obtained during compilation is not representative to the actual run. But that's probably very unlikely. And whatever gains you get from that have to offset the fact that these languages incite patterns that are generally awful for cache coherency, and generate a lot of garbage. Some C# microbenchmarks MAYBE could become faster than C++ in the future, but actual programs I think is extremely unlikely.
- SemanticStrengh 4y ago> But that's probably very unlikely. Wtf why?? Have you even the slightest idea if the breadth and the depth of a program's possible execution paths? It's a combinatorial explosion as show the difficulty and time of partial fuzzing.