Are Java 6's performance improvements in the JDK, JVM, or both?
Asked Answered
L

4

1

I've been wondering about the performance improvements touted in Java SE 6 - is it in the compiler or the runtime? Put another way, would a Java 5 application compiled by JDK 6 see an improvement run under JSE 5 (indicating improved compiler optimization)? Would a Java 5 application compiled by JDK 5 see an improvement run under JSE 6 (indicating improved runtime optimization)?

I've noticed that compiling under JDK 6 takes almost twice as long as it did under JDK 5 for the exact same codebase; I'm hoping that at least some of that extra time is being spent on compiler optimizations, hopefully leading to more performant JARs and WARs. Sun's JDK info doesn't really go into detail on the performance improvements they've made - I assume it's a little from column A, and a little from column B, but I wonder which is the greater influence. Does anyone know of any benchmarks done on JDK 6 vs. JDK 5?

Leyva answered 18/9, 2008 at 14:30 Comment(0)
A
4

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

Migration guide:

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

Performance whitepaper:

https://www.oracle.com/java/technologies/javase/6performance.html

Anear answered 18/9, 2008 at 14:38 Comment(0)
F
7

javac, which compiles from Java source to bytecodes, does almost no optimisation. Indeed optimisation would often make code actually run slower by being harder to analyse for later optimisation.

The only significant difference between generated code for 1.5 and 1.6 is that with -target 1.6 extra information is added about the state of the stack to make verification easier and faster (Java ME does this as well). This only affects class loading speeds.

The real optimising part is the hotspot compiler that compile bytecode to native code. This is even updated on some update releases. On Windows only the slower client C1 version of hotspot is distributed in the JRE by default. The server C2 hotspot runs faster (use -server on the java command line), but is slower to start up and uses more memory.

Also the libraries and tools (including javac) sometimes have optimisation work done.

I don't know why you are finding JDK 6 slower to compile code than JDK 5. Is there some subtle difference in set up?

Fieldsman answered 18/9, 2008 at 14:40 Comment(0)
A
4

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

Migration guide:

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

Performance whitepaper:

https://www.oracle.com/java/technologies/javase/6performance.html

Anear answered 18/9, 2008 at 14:38 Comment(0)
B
1

Its almost 100% the runtime. While it is possible for some basic compilation tricks to make it into the Java compiler itself, I don't believe there are any significant improvements between Java 1.5 and 1.6.

Backsight answered 18/9, 2008 at 14:34 Comment(0)
R
1

There's been a lot of new improvements and optimization in the new java virtual machine. So the main part you'll see improved performance is while running java with the version 6 jvm.

Compiling old java code using the Java 6 JDK will probably yield more efficient code, but the main improvements lie in the virtual machine, at least that's what I've noticed.

Revelry answered 18/9, 2008 at 14:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.