On Thursday, February 13, 2020 at 6:59:43 AM UTC+1, robert engels wrote: > > Here is some pretty indisputable evidence on the advancements of GC/JVM vs > C++. > > See this paper/project https://github.com/hundt98847/multi-language-bench > that > was done by Google in 2011. If you read the paper, the C++ code was tuned > by expert C++ programmers at Google. The java_pro author version refused to > optimize further - which he felt would create “esoteric non-idomatic” Java. > > The paper reports that the C++ code outperformed java_pro by 4x - 12x, and > go_pro by 5.5x > > I re-ran the tests using the latest C++ compiler,Go, and Java 13. The > code is unchanged since it was posted. Nothing has been modified (Go needed > the directory structure changed to compile). Different hardware. Different > OS. Different compilers. Different Java runtime. (same JVM settings - so > using a different default GC). All tests run on the same OS/hardware. > > C++ (-O2) = 16.5 secs > C++ (-O3) = 16.5 secs > go_pro = 19 secs > java_pro = 8.4 secs > > Or Java is almost 2x faster than C++, and Go is nearly the same > performance as C++. > > Run the tests yourself… (easy to do, Makefiles included) > > JVM/GC has improved DRAMATICALLY in the past 9 years - static > compilation/optimization not so much… Stressing again - ZERO CODE CHANGES ! > > Enjoy ! >
One can get Java performance from the C++ version by changing 3 lines of code: std::map -> std::unordered_map. The Java versions are using hashmaps as well. java_pro: Java 8 outperforms Java 13 by about 20%. IPC (instructions per clock) and runtime improve when the C++ code is compiled to target x86-32 (-m32 gcc option) instead of x86-64, outperforming Java 8 in elapsed time by 10%. The Java versions are consuming 10-20 times the memory of the C++ version. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/c970751a-aa3e-4656-876a-a5d9d9767bab%40googlegroups.com.