Fibonacci and performance

Tom Tromey tromey@redhat.com
Fri Apr 27 09:14:00 GMT 2001


>>>>> "Per" == Per Bothner <per@bothner.com> writes:

>> I wonder if inlining the "already initialized" check from
>> _Jv_InitClass would help or hurt (due to increased code size).

Per> The only class I can see that needs to be initialized in Fib.fib
Per> is Fib itself, but that has already been initialized - since
Per> we're executing Fib code.  Don't we test for this situation?  If
Per> not, it shouldn't be difficult to add.  Basically, drop calls to
Per> _Jv_InitClass if the class being initiazed is the current class
Per> or one of its super-classes.

Per> Or am I misunderstanding something?

Nope, Fib.fib is initializing the Fib class over and over.  I don't
know if we test for this situation or not, but I assume not.  I guess
this would only affect recursive calls.

Tom



More information about the Java mailing list