This is the mail archive of the mailing list for the Java project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Speed Impact experiment on GCJ

Hi Rui,

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,
> isn't ? 

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
generate it.



Attachment: signature.asc
Description: This is a digitally signed message part

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]