Version 2.3.3 vs 2.4.2a Timings

Colin J. Williams cjw at sympatico.ca
Fri Aug 13 02:09:34 CEST 2004


These timing results with Fibbonacci, using and not using memoize might 
be of interest.

Version 2.3.3   - Unwrapped is using interation in place of recursion
C:\Test>python tFib.py
Unwrapped, using fib:               7.52 usec/pass
Raw Fibonacci:                      252.66 usec/pass
Fibonacci with old deco:            3.18 usec/pass

Version 2.4.2a
C:\Test>\Python24\python.exe tFib.py
Unwrapped, using fib:               4.92 usec/pass
Fibonacci, using @memoize:          2.89 usec/pass
Raw Fibonacci:                      214.11 usec/pass
Fibonacci with old deco:            2.90 usec/pass

Conclusions:
2.4.2a provides a significant speedup for these cases.
The unwrapped approach is much better than recursive fibonacci, but not 
as good as with memoise.

This is based on Dan Bishop's code.

Colin W.




More information about the Python-list mailing list