It's a good start don't get me wrong, but it's running on an outdated CPU. I ran some benchmarks myself where golang was quicker than Java in the benchmarks page, and I got the opposite result.
I ran the spectral norm benchmark (input size 30000) with the following result:
golang:
1.274224153
18.81 real 70.19 user 0.38 sys
Java (I think it was even version 3, which ran faster for me than version 2 which currently tops the benchmarks list for Java):
1.274224153
16.18 real 105.95 user 0.45 sys
and nbody benchmark with input size 60000000:
golang:
-0.169075164
-0.169012474
6.09 real 6.04 user 0.02 sys
Java:
-0.169075164
-0.169012474
6.04 real 5.94 user 0.06 sys
I recall seeing a pull request submitted by someone for Java that uses Math.fma which should have speeded up that benchmark (don't recall which one it is, but it's available in the project's list of issues), but because the CPU used to run the benchmarks didn't support it, it actually caused a degraded performance.
The second issue with just relying on microbenchmarks to judge a platform is that they only test out specific parts of said platform, and do not highlight what it's capable of overall. For example, large Java programs do run faster than golang programs because of what the JIT is able to do (inlining, de-virtualization, certain cases of auto-vectorization, etc.), but microbenchmarks don't run long enough to be able to demonstrate this. Other long running Java programs work in high throughput rates (which the golang GC is bad at), again would be difficult to show in microbenchmarks.
0
u/couscous_ Jan 18 '20
It's a good start don't get me wrong, but it's running on an outdated CPU. I ran some benchmarks myself where golang was quicker than Java in the benchmarks page, and I got the opposite result.