Core Java

How much faster is Java 11?

Java 11 was released some time ago, although the majority of developers stay on Java 8. Let’s see which one of them is faster for OptaPlanner. The best way to find out is of course running OptaPlanner benchmarks. This article is a follow up on our similar article for Java 8.

Benchmark methodology

To run the benchmark we used:

  • A stable machine without any other computational demanding processes running and with2 x Intel® Xeon® CPU E5-2609 0 @ 2.4 GHz (8 cores total) and 31.3 GiB RAM memory, running RHEL 6.
  • Both G1 and Parallel GC for both Java versions to compare the impact of garbage collection. Java executed with the parameters -Xmx1536M -server -XX:+UseG1GC and -Xmx1536M -server -XX:+UseParallelGC respectively.
  • Both Oracle Java 8:
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

and OpenJDK 11:

openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
  • OptaPlanner 7.14.0.Final
  • Solving a planning problem involves no IO (except a few milliseconds during startup to load the input). A single CPU is completely saturated. It constantly creates many short lived objects, and the GC collects them afterwards.
  • Each run solves 11 planning problems with OptaPlanner. Each planning problem runs for 5 minutes and starts with a 30 second JVM warm up which is discarded.
  • The benchmarks measure the number of scores calculated per millisecond. Higher is better. Calculating a score for a proposed planning solution is non-trivial: it involves many calculations, including checking for conflicts between every entity and every other entity.

Executive summary

With Java 11, the average improvement is 16.1% for G1 and 4.5% for Parallel GC. Although Parallel GC is oriented towards throughput, whereas G1 focuses rather on low-latency garbage collection, the significant improvement of G1 in Java 11 lead to a direct comparison of these two garbage collection algorithms. For more information about difference between various GC algorithms, please see this article.

This shows that Parallel GC is still the preferred GC for OptaPlanner, as throughput is much more important for solving optimization problems with OptaPlanner than the latencies introduced by the GC.


Java 8 vs. Java 11

Cloud balancingMachine reassignmentCourse schedulingExam schedulingNurse rostering.Traveling Tournament
Java 838,07434,870113,49020,3984,2964,8407,0035,4372,3852,021812
OpenJDK 1141,75341,282166,67620,3634,4735,4668,1575,9272,7722,536957

Almost every data set improves on Java 11 over Java 8 using the G1 garbage collector. On average, there’s a 16% improvement just by switching to Java 11. A possible explanation for this improvement could be the JEP 307: Parallel Full GC for G1, introduced in Java 10.

Cloud balancingMachine reassignmentCourse schedulingExam schedulingNurse rostering.Traveling Tournament
Java 854,99052,514122,61113,3824,8215,8808,7756,1703,2342,682880
OpenJDK 1154,31650,120140,81611,1294,9276,0718,9966,3833,3363,0871,125

With the Parallel Garbage Collector, the results are less definite than G1. There is an improvement for some data sets, while others remain intact or show even a performance drop. However, on average, the Java 11 performs over 4% better.

Parallel GC vs. G1 GC on Java 11

Cloud balancingMachine reassignmentCourse schedulingExam schedulingNurse rostering.Traveling Tournament
Java 11200c800cB1B10c7c8s2s3m1mh1nl14
OpenJDK 11 Parallel GC54,31650,120140,81611,1294,9276,0718,9966,3833,3363,0871,125
OpenJDK 11 G1 GC41,75341,282166,67620,3634,4735,4668,1575,9272,7722,536957

Although G1 GC shows a clear improvement from Java 8, compared to Parallel GC it’s less beneficial GC strategy for OptaPlanner on the majority of the data sets. The only exception is Machine Reassignment, which shows that the G1 OptaPlanner is able to compute score calculation 83% faster. This applies to Java 8 too, as shown in Score calculation count per second with G1 GC.


Java 11 brings additional improvements, which vary across different OptaPlanner examples and data sets. On average, it is 4.5% faster when using Parallel GC and 16.1% faster with G1 GC. Despite the significant improvement for G1 GC, Parallel GC is still faster for most data sets in this benchmark.

Published on Java Code Geeks with permission by Radovak Synek , partner at our JCG program. See the original article here:  How much faster is Java 11?

Opinions expressed by Java Code Geeks contributors are their own.

Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Back to top button