I'm assuming there is vast performance difference between Java 1.4 and Java 6 after skimming this document.
My question, will Java 6 runtime still got its magic when the bytecode it has to run was compiled in 1.4?
Some background for "why the question?" is here.
Yes, because most of the optimizations are done at runtime by the JVM, compiler is doing very little with regards to optimization. Thus code compiled with old Java compiler will still benefit from new JVM.
However there are some optimizations performed at compile time, like replacing consecutive String
concatenations with StringBuilder
.
As Tomasz Nurkiewicz points out most of the optimization is done by the JIT compiler and you should see performance benefits by running on java 6 instead of java 1.4. However, this doesn't guarantee you will extract the best results. You can still miss out on benefits if you are using slower (older) variants of data structures. e.g. StringBuffer instead of StringBuilder, Vector instead of LinkedList, Hashtable instead of HashMap, and so on...
You can also consider compiling with the -deprecated flag for javac. You probably want to replace deprecated methods as they usually mean there is a better performing alternative available to achieve the same thing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With