Fibonacci and performance

Per Bothner per@bothner.com
Fri Apr 27 09:33:00 GMT 2001


Tom Tromey <tromey@redhat.com> writes:

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

What I forgot was that we do the Jv_InitClass at the start of the
called method, not at the call site.  This saves code space, but
it makes it harder to optimize the call away when it is unneeded.
We might re-consider this decision if/when we get smarter about
initialization.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/



More information about the Java mailing list