Hacker News new | ask | show | jobs
by Thaxll 1494 days ago
One benchmark where Go is slower than Java, what about the others where Go is faster or as fast but use between 2 and 20x less memory, looks like the GC is not that bad after all.

https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

As for Discord it was a specific use case, it does not means Go has specific GC issues overall. How Java would have compared against Rust? 100% sure it would have performed worse, but you can't say for sure that Java would have performed better, especially after a re-write, rewriting the Go Discord Go in Go could have fixed the issue, no one knows.

3 comments

The others don't matter as we're talking about GC performance under load. Moving the goal post to benchmarks that don't involve putting the GC under load aren't relevant to the conversation.
So all memory in Go is managed by the GC but somehow other benchmarks don't matter, right ...

The JVM is probably heavily optimized for what a binary tree is doing, does not mean the JVM overall is better for all use cases.

The stack is not managed by the GC in the ordinary meaning so.. benchmarks that only allocate on the stack literally doesn’t matter.

And by “what a binary tree is doing” you mean like.. garbage collecting no longer used objects? Like, why is it hard to believe that the runtime on which perhaps the majority of serious, huge web services run (twitter, apple’s web services, but google as well are huge java shops), the likes of which handle 325,000 transactions per second (Alibaba) underwent a tremendous amount of engineering and in the GC category is definitely the queen?

Go has an advantage in the niche cases where you can get away with value types. But that is a very rare use case, reminiscent of embedded programs. You almost always need heap allocations, especially for long running, large apps — and Java has the state of the art GC implementation on both throughput and low-latency front.
Well your "niche" use case is one of the reason why Go uses less memory than Java most of the time.
Other benchmarks don't stress the GC enough, only the binary-tree one does.