• Menu
  • Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

JavaBeat

Java Tutorial Blog

  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)

How Much Faster Is Java 8?

April 15, 2014 //  by Geoffrey De Smet//  Leave a Comment

Java SE 8 was released last month (March 18, 2014). Traditionally, every new major JRE version comes with a free performance boost. Do we get another free lunch? And how big is the gain this time?

Let’s benchmark it.

Benchmark methodology

  • Run the same code with 3 different JRE versions (SunJDK 1.6.0_26, OpenJDK 1.7.0_51 and OpenJDK 1.8.0). The code itself was written for Java 6 (both in syntax and JDK API’s usage) and compiled for Java 6 with OpenJDK 1.7.
  • Each run takes about 55 minutes.
  • VM arguments: -Xmx1536M -server
    Software: Linux 3.2.0-59-generic-pae
    Hardware: Intel® Xeon® CPU W3550 @ 3.07GHz
  • Each run solves 13 planning problems with OptaPlanner. Each planning problem runs for 5 to minutes. Up to 2 planning problems are solved in parallel.
  • 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 that can be 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.

To reproduce this benchmark locally, build optaplanner from source and run the main class GeneralOptaPlannerBenchmarkApp.

Benchmark Results

Java 8 Performance

My observations:

  • On the biggest dataset (Machine Reassignment B10), which dwarfs any of the other datasets in size, Java 8 is 20% faster than Java 7, which was already 17% faster than Java 6.
  • In some cases, Java 8 is slower than Java 7. Specially for the course scheduling datasets, Java 8 is 6% slower than Java 7. Hopefully new releases of Java 8 will resolve this performance regression soon.
  • On average, Java 8 is only 1% faster than Java 7. This while Java 7 is already 16% faster than Java 6.
  • Despite that this is the first final release of OpenJDK 8, I did not find any regressions in Java 8. OptaPlanner’s examples are 100% reproducible, so as expected, the different JRE’s give the exact same results at every single iteration.

Raw Benchmark Numbers

optaplanner-bench

Conclusion

On the big datasets, Java 8 is clearly faster. And this without changing a line of code. On average, the result is less convincing (with the current release), but a free lunch is always welcome.

This article is originally published at OptaPlanner Blog, re-posted here with authors permission and as part of the JBC program.

Category: JavaTag: Java 8

Previous Post: « PrimeFaces AutoComplete + AjaxBehavior Example
Next Post: Eclipse Tips : How To View Heap Status In Eclipse »

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

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

Primary Sidebar

Follow Us

  • Facebook
  • Pinterest

FEATURED TUTORIALS

New Features in Spring Boot 1.4

Difference Between @RequestParam and @PathVariable in Spring MVC

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Introductiion to Jakarta Struts

What’s new in Struts 2.0? – Struts 2.0 Framework

JavaBeat

Copyright © by JavaBeat · All rights reserved
Privacy Policy | Contact