3 ms·
It kills me that given all that people would still say "java is as fast as c++!"
by jcelerier 5y ago
It kills me that given all that people would still say "java is as fast as c++!"
- KronisLV 5y agoThat's a simple statement about a complicated situation, which doesn't do it justice. When comparing synthetic benchmarks, C++ is 1-5x faster: https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/gpp-java.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... When comparing real world benchmarks (webdev), C++ still is faster, but only sometimes, it all depends on the framework used: https://www.techempower.com/benchmarks/#section=data-r20&hw=ph&test=composite&l=ziimbj-sf https://www.techempower.com/benchmarks/#section=data-r20&hw=... I think that this is largely a sign of various small inefficiencies and design decisions adding up in any piece of code - and the larger the codebase, the more of these there will be, which is why for non-trivial programs C++ can actually be slower than Java. Not because the ideal C++ code is slower than the ideal Java code (with realistic runtimes), but rather because in practice you'll never get to this ideal code. JetBrains paid a certain price in performance, just so they could get rich cross platform IDEs working. That said, Visual Studio is written in both C++ and C#, and suffers similarly in many hardware configurations. I think Wirth's law is at play here: https://en.wikipedia.org/wiki/Wirth%27s_law https://en.wikipedia.org/wiki/Wirth%27s_law With that in mind, write code in whatever will give you the best results, whether you're optimizing for speed/ease of development, or runtime performance. In most companies, the former two are more important than the latter, which is okay with me, as long as i don't have to pay for their servers.
- jcelerier 5y ago> I think that this is largely a sign of various small inefficiencies and design decisions adding up in any piece of code - and the larger the codebase, the more of these there will be, which is why for non-trivial programs C++ can actually be slower than Java. Not because the ideal C++ code is slower than the ideal Java code (with realistic runtimes), but rather because in practice you'll never get to this ideal code. but this isn't what we observe in practice: all the C++ apps I know and use regularly consistently work better than their Java equivalents AND perform faster. Jetbrains IDEs are unuseable for me coming from Qt Creator and I don't understand how anyone can stay sane with them - and I try CLion pretty much every year since it's been announced. Besides, what matters to compare language is not how the ideal, infinitely optimized app looks like, but how the average one does. And, to me, the average Java app is unambiguously terrible when compared to the average C++ one.