how fast can gcc with java be, compared with a jit
Tue Sep 26 12:35:00 GMT 2000
Magnus Persson wrote:
> Which optimizations are thought to be included there ?
GCC performs many common optimizations. Recent versions can perform
interprocedural analysis, alias detection, common subexpression elimination and
instruction scheduling, among many other things... what did you have in mind?
> please see what ibm have come up with...
I'm aware of IBM's JIT. It's been available for a year or two, I think. They
didn't do anything revolutionary as far as I can tell, they just did it very
> Maybe running java-code fast needs these optimizations at least.
> They seem to be specific for java-code, and not for c-code (which gcc was
> made for).
There are compiler optimizations, most of which are not java-specific, and
runtime enhancements, which are part of libgcj and not used by the other
Some things are implemented, like fast interface dispatch and bitmap marking.
See the java-discuss archives for details. Others are on the wish list:
In general, a static compiler can do everything a JIT can, except maybe adaptive
compilation based on profiling (and some static compilers do that too).
Additionally, GCC can perform various expensive optimizations that are
impractical for a JIT.
> When doing FIR-filters i have found that ibm:s jdk1.3 is 20 percent faster
> than gcc-optimized c-code !
That's not too surprising. For one thing, C may not be as well suited to
optimization as other languages. Alias detection is notoriously difficult in C,
and functions are never inlined (unless you use GCC's "inline" extension).
For another, the GCC supports many more optimization flags than IBM's JDK, which
allow for more fine-grained control of the compilation process but also make it
easier to get it wrong.
Also, automatic memory management (aka garbage collection) is on occasion known
to outperform manual techniques (aka malloc/free).
If you are on x86, C compilers are especially prone to register spillage, which
can be very detrimental to the performance of your app. (It'd be nice if gcc
could emit statistics for register use... anybody know about that?)
More information about the Java