问题
I'm developing a imaging processing Java 7u80 application using C++ libraries through JNI.
As I was willing to execute streams in parallel with Java 8u60, I just switched to JDK 8 and relaunched all my unit tests.
Java 8u60 Overall duration: **35'408 [ms]**
Java 7u80 Overall duration: **29'581 [ms]**
Java 7 is in my case 17% faster than Java 8 (same code, code level resp. 7 and 8).
- I was wondering if such result may be specific to my application or if others have already notice a downgrade of the performance moving form Java 7 to 8?
- Are there particular optimization to do in the code to get the best of Java 8?
If nothing can be done, I would then rather implement the multithreading code with Java 7 rather than 8, to keep the performance gain I already have with Java 7.
回答1:
Launched 21 SOAPUI (Parallel) tests against WLS 12.1.3 running resp. Java 7u51(*) and Java 8u60 on my test environment.
Test results below (screenshots included in case of).
To summarize: SOAPUI time is simply the SOAPUI execution time for each pass, while
the JMX time (cumulative between each pass) is the time spend on the critical part of my application.
The JMX metrics is the computational time (the one I try to minimize). I won't rely on the SOAPUI metric as I don't know how it is calculated exactly
As per SOAPUI, JDK 7u51 was 6.7% faster than JDK 8u60.
As per JMX, JDK 7u51 was 15.6% faster than JDK 8u60.
The latter confirm (to me) the trend observed in my unit tests - same result. Despite these tests are probably not the one to use to evaluate a JVM performance, I guess that in my case scenario, it is preferable to stay on JDK7, as in my case, the performance aspect is important.
Java 7
Pass1 SOAPUI: 22'324 [ms] - JMX :16'286 [ms]
Pass2 SOAPUI: 24'129 [ms] - JMX :33'510 [ms]
Pass3 SOAPUI: 22'170 [ms] - JMX :49'923 [ms]
TOTAL SOAPUI: 68'623 [ms]
(JMX: 49'923 [ms])
Java 8
Pass1 SOAPUI: 25'150 [ms] - JMX :19'767 [ms]
Pass2 SOAPUI: 24'564 [ms] - JMX :39'702 [ms]
Pass3 SOAPUI: 23'846 [ms] - JMX :59'172 [ms]
TOTAL SOAPUI: 73'560 [ms]
(JMX: 59'172 [ms])
(*): no time to install Java 7u60 as in my unit test
Screenshots
来源:https://stackoverflow.com/questions/33038895/java-8-performance-vs-java-7