This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Fibonacci and performance
- To: Per Bothner <per at bothner dot com>
- Subject: Re: Fibonacci and performance
- From: Jonathan P. Olson <olson at mmsi dot com>
- Date: Fri, 27 Apr 2001 10:16:35 -0700
- Cc: tromey at redhat dot com,Java Discuss List <java at gcc dot gnu dot org>
Just out of curiosity, does the performance penalty go away when
you make `fib' non-static?
Surely, GCJ will eliminate the call to _Jv_InitClass() when fib() is
an instance method, then the only penalty would be passing the
unused `this' pointer.
On Friday, April 27, 2001, at 09:07 AM, Per Bothner wrote:
> Tom Tromey <tromey@redhat.com> writes:
>
>> Looking at the generated assembly, the only real difference I see is
>> the call to _Jv_InitClass in Fib.fib(). In this particular case we're
>> paying a pretty big penalty.
>>
>> I wonder if inlining the "already initialized" check from
>> _Jv_InitClass would help or hurt (due to increased code size).
>
> The only class I can see that needs to be initialized in Fib.fib is
> Fib itself, but that has already been initialized - since we're
> executing Fib code. Don't we test for this situation? If not, it
> shouldn't be difficult to add. Basically, drop calls to _Jv_InitClass
> if the class being initiazed is the current class or one of its
> super-classes.
>
> Or am I misunderstanding something?
> --
> --Per Bothner
> per@bothner.com http://www.bothner.com/~per/