r/java • • Mar 10 '26

Java 18 to 25 performance benchmark

Hi everyone

I just published a benchmark for Java 18 through 25.

After sharing a few runtime microbenchmarks recently, I got a lot of feedback asking for Java. I also got comments saying that microbenchmarks alone do not represent a full application very well, so this time I expanded the suite and added a synthetic application benchmark alongside the microbenchmarks.

This one took longer than I expected, but I think the result is much more useful.

Benchmark1819202122232425
Synthetic application throughput (M ops/s)18.5518.9418.9822.4718.6618.5522.9023.67
Synthetic application latency (us)1.1301.1271.1251.0751.1291.1281.0641.057
JSON parsing (ops/s)79,941,64077,808,10579,826,84869,669,67482,323,30480,344,57771,160,26368,357,756
JSON serialization (ops/s)38,601,78939,220,65239,463,13847,406,60540,613,24340,665,47650,328,27049,761,067
SHA-256 hashing (ops/s)15,117,03215,018,99915,119,68815,161,88115,353,05815,439,94415,276,35215,244,997
Regex field extraction (ops/s)40,882,67150,029,13548,059,66052,161,77644,744,04262,299,73549,458,22048,373,047
ConcurrentHashMap churn (ops/s)45,057,85372,190,07071,805,10071,391,59862,644,85968,577,21577,575,60277,285,859
Deflater throughput (ops/s)610,295617,296613,737599,756614,706612,546611,527633,739

Full charts and all benchmarks are available here: Full Benchmark

Let me know if you'd like me to benchmark more

129 Upvotes

41 comments sorted by

View all comments

4

u/brunocborges Mar 10 '26

The sections about "Resident memory by heap size" and "Java heap used by heap size" are pointless because you are setting minimum heap sizes. It makes sense that the bars are all the same in those charts.

By setting a minimum heap size, you give no choice to GCs.

And I would get rid of the "non-LTS" versions. Just keep 18, 21, and 25. The other versions are just noise, in my opinion.

Finally, I'd suggest you add JIT compiler logs to check if you are missing C2 compilation optimization in your benchmark.

1

u/[deleted] Mar 11 '26

[removed] — view removed comment

1

u/Bit_Hash Mar 11 '26

If we talking about a continuously running server application, then you actually want Xms same as Xmx and `-XX:+AlwaysPreTouch`. Unless you co-locate manymicroserivces and expected them to "autoscale" with load (usually does not end well).