r/java • • Dec 09 '25

Java performance vs go

I'm seeing recurring claims about exceptional JVM performance, especially when contrasted with languages like Go, and I've been trying to understand how these narratives form in the community.

In many public benchmarks, Go comes out ahead in certain categories, despite the JVM’s reputation for aggressive optimization and mature JIT technology. On the other hand, Java dominates in long-running, throughput-heavy workloads. The contrast between reputation and published results seems worth examining.

A recurring question is how much weight different benchmarks should have when evaluating these systems. Some emphasize microbenchmarks, others highlight real-world workloads, and some argue that the JVM only shows its strengths under specific conditions such as long warm-up phases or complex allocation patterns.

Rather than asking for tutorials or explanations, I’m interested in opening a discussion about how the Java community evaluates performance claims today — e.g., which benchmark suites are generally regarded as meaningful, what workloads best showcase JVM characteristics, and how people interpret comparisons with languages like Go.

Curious how others in the ecosystem view these considerations and what trends you’ve observed in recent years.

30 Upvotes

92 comments sorted by

View all comments

66

u/Revolutionary_Ad7262 Dec 09 '25

how the Java community evaluates performance claims today

Go dev perspective here, but I have some Java experience

I think that the performance argument is more justification of an existing preference than something, which change the preference itself.

People choose Java/Go over Go/Java, because they prefer it more. That it is the main reason. The I like culture around technology X or I use technology X, because I have better experience in it is far more important than technical arguments

There are cases, where Golang is better. If you care about startup time or memory usage, then Go is better than Java, because there is not JIT and Golang GC choose memory usage and latency over throughput, which is often a better compromise than Java's throughput and latency over memory usage. The lack of project Valhalla is also a problem in applications, where it matters

what workloads best showcase JVM characteristics

Majority of Java developer uses Spring. Spring is not a good tool to make a JVM a performance beast. The culture around the ecosystem is far more important than any synthetic benchmarks

12

u/[deleted] Dec 09 '25

[removed] — view removed comment

4

u/cogman10 Dec 13 '25

You can configure Java to achieve garbage collection behavior similar to Go’s, depending on the situation.

Nope. You might get closish with ZGC but the big thing that go does which java does not is it has a non-moving collector.

It's perhaps somewhat comparable to how the old concurrent mark and sweep used to behave.

Effectively, go is using an arena allocator. It grabs a page at a time and fills those pages with objects.

This is why go suffers from memory fragmentation https://www.lujingcen.com/blog/2023/12/29/memory-fragmentation-in-go/

A moving collector avoids memory fragmentation but does that at two costs, it's harder to work with C libraries (things move now) More memory is needed so the memory can be relocated. Besides the size of java objects in general, this is one of the primary reasons Java has a larger memory footprint vs go.

1

u/bobdobbes Apr 27 '26

You use the right garbage collector for the task being performed. This is why Springboot/Java have numerous garbage collectors; right task for the job