Hacker News new | ask | show | jobs
by coldtea 2374 days ago
See what? This is an unofficial benchmark game - and based on implementations people bothered to provide. Not some scientific test, and nothing that guarantees these are the best implementations. And even if they were they're not representative of server/long running program behavior (where JIT quality and especially GC implementation) matters.

Even so, the page linked starts with "Back in April 2010, Russ Cox charitably suggested that only fannkuch-redux, fasta, k-nucleotide, mandlebrot, nbody, reverse-complement and spectral-norm were close to fair comparisons".

Since Russ Cox is one of the Go co-developers, lets see the ones he accepts are fair. Of those 5 are present in the page, on 3 of which Java wins with decent margins (fannkuch-redux: 18%, k-nucleotide: 21%, reverse-complement: 17.5%) and on 2 of which Go barely comes ahead (fasta: 6.3%, spectral-norm: 6%).

2 comments

I used both Java and Go in production and yes Go can be faster or Java it depends but Go usually use between 3 and 10x less memory.

https://www.techempower.com/benchmarks/ ( real world benchmark with networking / serialization ect ... )

Get over it yes Go can be faster than Java it's not a secret.

> real world benchmark

Highly debatable. Even then, you see that golang ranks in the 102nd place for the plaintext benchmark, almost 6x slower than Netty, which is very established in the JVM world. Same with the JSON benchmark, golang is in the 126th place, ~3.5x slower than Netty and Vertx.

> but Go usually use between 3 and 10x less memory.

The JVM by default will use whatever memory is assigned to it. This makes sense from an efficiency and utilization point of view, as it generally aims for maintaining good throughput (whereas golang is only tuned for latency). The JVM now ships with new low latency GCs (ZGC and Shenandoah) which are currently available in experimental phase.

You didn't read the benchmark properly, plaintext benchmark it's 6th.
The first golang result in the plaintext benchmark ranks 8th (atreugo-prefork), which is incidentally immediately followed by firenio-http-lite, a Java library.

My point still stands, this is a third party library that is not commonly used, and depends on another third party library, fasthttp, which itself comes with caveats from the its author.

Doesn't matter, it's still Go code, and contrary to many languages on that benchmark ( Java included ) all Go code is built in Go, so there is no runtime / external library written in C/C++. ( one of the reason why Go is also slow on the regex benchmarks )
That is for the purpose of "measuring the quality of the generated code when both compilers are presented with what amounts to the same program." But Go also allows pointers to fields and array elements and by design reduces pointer indirections and allocations in general, which those comparisons don't capture.