开发者

Java 1.4 Class performance on 1.5 JVM

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 a开发者_C百科re run on 1.5 JVM, will these classes suffer in performance because they were compiled using 1.4 ?


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."


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜