Jennifer Reese wrote:Also, don't forget the javac compiler has a -O option that will result in the compiler optimizing the compiled code.
No, it doesn't. And if it does, then it's not in
the documentation.
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.