Fibonacci and performance
Tom Tromey
tromey@redhat.com
Fri Apr 27 11:53:00 GMT 2001
>>>>> "Tony" == Tony Kimball <alk@pobox.com> writes:
Tony> When I made the fib(x) method not to be static any more,
Tony> the time was cut roughly in half:
Ok. But when I compare the non-static Fib.java against fib.cc I still
see a difference:
creche. ./Fx ; echo ; ./Fj
102334155
Fibonacci: n = 40 took 15789 ms
102334155
Fibonacci: n = 40 took 21070 ms
In this case the gcj assembly output looks very different from the g++
output (before the change it was very similar). For one thing the
assembly (both at -O2) for the function in question is almost twice as
long for gcj.
Tom
More information about the Java
mailing list