Help with performance issues.

Tom Tromey tromey@redhat.com
Fri Aug 3 17:37:00 GMT 2001


>>>>> "Bill" == Bill Bland <wjb@netpd.com> writes:

Bill> 	As requested, here is a some actual code.  On our test machine
Bill> (i686, Mandrake linux 8) using the attached make script to
Bill> compile the gcj and jdk versions results in the gcj version
Bill> consistantly running around 10-20 seconds slower than the jdk
Bill> version.  Once again, thanks for all the help on this.

I've looked at this a little bit.

Here's something interesting:

I noticed that `myclass.find' inlines `myclass.abs'.  However, the
now-useless class initialization call in `abs' is also inlined!  So
the code in find turns out to be pretty bad:

	    movl	8(%eax,%edx,4), %ecx
	    movl	$_ZN7myclass6class$E, (%esp)
	    subl	%ecx, %esi
	    call	_Jv_InitClass
	    testl	%esi, %esi
	    movl	%esi, %eax
	    jns	.L99
	    movl	%esi, %eax
	    negl	%eax
    .L99:

There's no reason to do class initialization here.  The very fact that
we're calling from a static method in the same class implies that the
class is already initialized.

This might be hard to express to the back end though.  Maybe this is
something we can fix once the tree-based inliner is in place.

Changing abs to `private' got rid of this call.  For some reason
though this made the runtime go up.  I don't understand that.

Obviously we still have more work to do.  More analysis is required to
see exactly what that work is, though.


I don't have JDK 1.3 installed, so I didn't do any performance
comparisons.

Tom



More information about the Java mailing list