How much faster is Java 17?

 

Java 17 (released yesterday) comes with many new features and enhancements.
However, most of those require code changes to benefit from.
Expect for performance.
Simply switch your JDK installation and you get a free performance boost.
But how much? Is it worth it?
Let’s find out by comparing the benchmarks of JDK 17, JDK 16 and JDK 11.

Benchmark methodology

  • Hardware: A stable machine without any other computational demanding processes running and with
    Intel® Xeon® Silver 4116 @ 2.1 GHz (12 cores total / 24 threads) and 128 GiB RAM memory, running RHEL 8 x86_64.
  • JDKs (used to both compile and run):
    • JDK 11
      openjdk 11.0.12 2021-07-20
      OpenJDK Runtime Environment Temurin-11.0.12+7 (build 11.0.12+7)
      OpenJDK 64-Bit Server VM Temurin-11.0.12+7 (build 11.0.12+7, mixed mode)
    • JDK 16
      openjdk 16.0.2 2021-07-20
      OpenJDK Runtime Environment (build 16.0.2+7-67)
      OpenJDK 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)
    • JDK 17 (downloaded 2021-09-06)
      openjdk 17 2021-09-14
      OpenJDK Runtime Environment (build 17+35-2724)
      OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)
  • JVM options: -Xmx3840M and explicitly specify a garbage collector:
    • -XX:+UseG1GC for G1GC, the low latency garbage collector (the default in all three JDKs).
    • -XX:+UseParallelGC for ParallelGC, the high throughput garbage collector.
  • Main class: org.optaplanner.examples.app.GeneralOptaPlannerBenchmarkApp
    from the module optaplanner-examples in OptaPlanner 8.10.0.Final.

    • Each run solves 11 planning problems with OptaPlanner, such as
      employee rostering,
      school timetabling and
      cloud optimization.
      Each planning problem runs for 5 minutes. Logging is set to INFO.
      The benchmark starts with a 30 second JVM warm up which is discarded.
    • 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.
    • The benchmarks measure the number of scores calculated per second. 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.
  • Runs: Each JDK and each garbage collector combination is run 3 times sequentially.
    The results below is the average of those 3 runs.
This post was original published on here.
1 2 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments