views:

131

answers:

3

Q.1. What free compiler produces the most optimal Java bytecode?

Q.2. What free virtual machine executes Java bytecode the fastest (on 64-bit multi-core CPUs)?

Q.3. What other (currently active) compiler projects are missing from this list:

Q.4. What performance improvements can compilers do that JITs cannot (or do not)?

Q.5. Where are some recent benchmarks, comparisons, or shoot-outs (for Q1 or Q2)?

Thank you!

+6  A: 

Q.1. What free compiler produces the fastest executable Java bytecode?

Question doesn't really make sense. The bytecode is not executed. The compiled bytecode will not be different enough to influence the efficiency of the produced machine code when using a good JIT.

Q.2. What free virtual machine executes Java bytecode the fastest (on 64-bit multi-core CPUs)?

This is a better question. I believe it's JRockit

Q.3. What other (currently active) compiler projects are missing from this list:

I believe you missed out JRockit. But for a more complete list, I'd look at Wikipedia: List of Java Virtual Machines. Looking up whether or not they're active should be an easy task.

Q.4. What performance improvements can compilers do that JITs cannot (or do not)?

Technically none I suppose. The bytecode compilation is basically the wrong place to put the effort when it comes to optimization.

Q.5. Where are some recent benchmarks, comparisons, or shoot-outs (for Q1 or Q2)?

Google is your friend here. These are two:

unfortunately those don't cover that many VMs.

aioobe
@aioobe: Thank you! Re: Compilation question... There are a number of optimizations that some compilers still don't perform (such as initializing instance variables to `false`, `null`, or `0`). Sun's compiler (and JIT, I believe) create and execute the bytecode for those redundant assignments. I am looking for compilers that are "smarter" than Sun's, er, Oracle's.
Dave Jarvis
Is JRockit free? I thought there were strings attached when going in production.
Thorbjørn Ravn Andersen
@Thorbjørn: http://www.oracle.com/technology/software/products/jrockit/faq.html - Not free for production (I think), but at least there are very few straightforward answers in the FAQ.
Dave Jarvis
A: 

The only viable alternative to javac at the moment is the Eclipse compiler.

Have a look at it. Question is what you have found to be inefficient and if it really matters.

Thorbjørn Ravn Andersen
+1  A: 

Q.4. What performance improvements can compilers do that JITs cannot (or do not)?

A JIT compiler can perform global optimizations. A bytecode compiler cannot do this because it cannot see all of the libraries that are loaded during the running of the program.

A JIT compiler can perform branch optimizations based on the observed behavior of the current program execution. A bytecode compiler cannot do this because by the time the program starts running the compiler is already out of the picture.

Stephen C
@Stephen: Was really looking for the other way around. For example, would a JIT remove redundant instance variable assignments to `null`?
Dave Jarvis
@Dave Jarvis - This is certainly an optimization that a JIT compiler *can* do. Whether it *does* do it can only be answered on a case by case basis.
Stephen C