This is the mail archive of the
mailing list for the Java project.
Re: Speed Impact experiment on GCJ
It would be of interest to know what JVM you're using for the non compiled case. Is it the
gij interpreter or a Sun Java 1.5, or something else?
Mark Wielaard wrote:
On Wed, 2006-02-15 at 01:41 +0000, Rui Wang wrote:
Having compiled the code with -O3 flag, it runs much faster compare to
previous one. Thanks.
Great. Please do post the results so people can compare with the
unoptimized version. It is interesting to see how different ways to
compile a program impact the speed.
However, I wonder why we need optimization to make native machine code
running faster than Java bytecode? In my experiment, the code is no
more complicated than a HelloWrold program. It has no features that
will mess things up like dynamic class loading. Therefore, the
translation from Java to native code should be straightforward,
Without -O2 (or higher) the compiler tries to produce native code as
fast as possible without even looking for some simple tricks to get fast
code. It doesn't know this is just a very small program (you might link
it with hundreds of files later) and it tries to get you code as soon as
possible in the most naive way. If you tell it you want optimized code
(-O2) it actually tries to give that to you, but it might take longer to