Are Java 6 performance improvements in the JDK, JVM, or both?

I was interested to learn about the performance improvements described in Java SE 6 - is it in the compiler or at runtime? In other words, will the Java 5 application compiled by JDK 6 see how the enhancement works in JSE 5 (which indicates improved compiler optimization)? Will the Java 5 application compiled by JDK 5 see how the improvement works in JSE 6 (which indicates improved run-time optimization)?

I noticed that compiling under JDK 6 takes almost twice as much as compiling under JDK 5 for the same code base; I hope that at least part of this extra time will be spent on optimizing the compiler, and hopefully will lead to stronger JARs and WARs. The Sun JDK information doesnโ€™t really go into the details of the performance improvements that they have made - I assume this is a bit from column A, and a little from column B, but I wonder what the bigger impact is. Does anyone know of any tests done in JDK 6 vs JDK 5?

+3
source share
4 answers

I have not heard about improvements in the compiler, but extensive information has been published about performance improvements at runtime.

Migration Guide:

[ http://java.sun.com/javase/6/webnotes/adoption/adoptionguide.html]

Performance Technical Documentation:

[ http://java.sun.com/performance/reference/whitepapers/6_performance.html]

+3
source

javac, which compiles from a Java source into bytecodes, is almost not optimized. In fact, optimization often leads to slower code performance, making it harder to parse for subsequent optimization.

The only significant difference between the generated code for 1.5 and 1.6 is that when adding 1.6, additional information about the state of the stack is added to make checking easier and faster (Java ME does this as well). This only affects the loading speed of classes.

The real part of optimization is the hotspot compiler, which compiles the bytecode into native code. It is even updated in some versions of updates. On Windows, by default, the JRE only distributes the slow client version of the C1 access point. The C2 server host point is faster (use -server on the java command line), but it starts more slowly and uses more memory.

Also, libraries and tools (including javac) sometimes do optimization work.

I donโ€™t know why you find JDK 6 slower to compile code than JDK 5. Is there any subtle difference in the setup?

+7
source

Almost 100% of the execution time. Although some basic compilation tricks can be done by the Java compiler itself, I donโ€™t think there are significant improvements between Java 1.5 and 1.6.

+1
source

The new Java virtual machine has many new improvements and optimizations. So the main part that you will see improved performance is running java with version 6 of jvm.

Compiling old java code using the Java 6 JDK is likely to give more efficient code, but the main improvements lie in the virtual machine, at least what I noticed.

+1
source

Source: https://habr.com/ru/post/906018/


All Articles