Java 7 vs. Java 8: Performance Benchmarking of Fork/Join
With the recent release of Java 8, developers are still just beginning to asses the strengths and weaknesses of the new platform. The most pressing question is: Does Java 8 have the fastest JVM so far? A good way to asses the progress of Java 8 is to test its ability to work with something that was new to Java 7... Fork/Join.
Oleg Shelajev uses the "infamous" Java Microbenchmark Harness project (JMH) to create a benchmark test for the two most recent versions of Java. But before implementing the benchmark, he takes the time to give a brief overview of Fork/Join and how it changes between Java 7 and 8.
Here is a graph of the results:
Based on these results, Oleg recommends taking a chance and upgrading to Java 8, especially if you are working with mapreducing or Fork/Join. This is his interpretation of the data that lead him to that conclusion:
One can see that the baseline results, which show the throughput of running the math directly in a single thread do not differ between the JDK 7 and 8. However, when we include the overhead of managing recursive tasks and going through a ForkJoin execution then Java 8 is much faster. The numbers for this simple benchmark suggest that the overhead of managing ForkJoin tasks is around 35% more performant in the latest release.
Check out the full article! It is very informative, has great visuals, and tackles complexity with clarity.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)