If you're asking about the Sun / Oracle Java implementations, then yes, Oracle's Java 7 JVM is certainly faster than older versions. In each new Java version from Oracle there are new optimizations and other performance improvements.
It is true there are improvements in the performance of the JVM with each release. However, the new features of Java 7 are intended to help you improve the maintainability and efficiency of your applications. This could in turn result in more reliable and possibly faster execution. For example, in our book we discuss the ThreadLocalRandom class. This class, when used in place of the older Random class, will improve the performance of your threads.
Also, don't forget the javac compiler has a -O option that will result in the compiler optimizing the compiled code.
The Java compiler (javac) doesn't do a lot of optimization. The JIT compiler that's part of the JVM on the other hand, does a lot of very sophisticated optimizations when it compiles the Java byte code to native machine code.
There's a reason why javac doesn't optimize. By not doing a lot of optimization, javac makes it easier for the JIT to generate optimized native machine code.
Joined: Mar 08, 2012
Oops, you're right! As of 1.3, the -O has been deprecated and should not be used. In earlier releases, it would inline static, final and private methods to attempt to speed up your code.
Jennifer Reese wrote:Oops, you're right! As of 1.3, the -O has been deprecated and should not be used. In earlier releases, it would inline static, final and private methods to attempt to speed up your code. . . .
Presumably using JIT techniques works a lot better than trying inlining.