This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Fibonacci and performance


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]