tags:

views:

76

answers:

3

Switching from JVM 1.4 to 1.5 has performance benefits as per release notes. http://java.sun.com/j2se/1.5.0/docs/relnotes/features.html#performance

We have Java 1.4 compiled classes which are run on 1.5 JVM, will these classes suffer in performance because they were compiled using 1.4 ?

+2  A: 

Many of these features are "syntactic sugar". Meaning the language has new features, but it compiles to the same bytecode. So no, you shouldn't suffer in performance. Same bytecode on an updated VM.

"J2SE 5.0 is strongly compatible with previous versions of the Java 2 platform. Almost all existing programs should run on J2SE 5.0 without modification. However, there are some minor potential source and binary incompatibilities in the JRE and JDK that involve rare circumstances and "corner cases" that we are documenting here for completeness." -Sun/Oracle

http://java.sun.com/j2se/1.5.0/compatibility.html#incompatibilities

Also, depending on who coded your 1.4 classes, they may have had intimate knowledge of a particular VM/gc implementation and optimized for that. Not likely, but who knows.
The best way to know hos something performs is to run & profile. "Measure, don't guess."

z5h
A: 

You might want to check this SO thread: http://stackoverflow.com/questions/93049/are-java-6s-performance-improvements-in-the-jdk-jvm-or-both

(especially the response by Tom Hawtin)

mindas
The linkef answer is helpful in understanding why a code compiler with earlier version of Java would not suffer the performance.
tech20nn
A: 

Actually string operations will be faster in the classes compiled for 1.5 because the class StringBuilder can be used instead of StringBuffer. StringBuilder is a non-synchronized version of StringBuffer that was introduced in 1.5.

Maurice Perry