first test

Bryce McKinlay mckinlay@redhat.com
Wed Jul 14 21:28:00 GMT 2004


Alessandro Di Maria wrote:

> running it on Mac OS X 10.3.4 1.33 GHz G4:
>
> java Loop
> time: 2269
>
> gcj --main=Loop -o Loop Loop.java
> ./Loop
> time: 4369
>
> ??? the app compiled with gcj is twice as much slow as the one running 
> through the VM ???
> Redoing the test doesn't change much.
>
> Have I done something wrong?


You didn't say what version of gcj you are using, but until very 
recently, gcj on Darwin (aka OS X) was very slow because it lacked 
support for converting signals into NullPointerExceptions. This meant 
that it had to insert an explicit check for null pointers every time an 
object is accessed. You need to use the latest gcc from CVS to get the 
new code, I don't think it has been added to the GCC 3.4 branch (yet?).

Also, you should compile your code with -O2 to get the best performance, 
however in this case it probably doesn't make much difference because 
the vast majority of runtime is spent in the various library calls.

Regards

Bryce



More information about the Java mailing list