Prothon gets Major Facelift in Vers 0.1.0 [Prothon]
Valentino Volonghi aka Dialtone
dialton3#NOSPAM#.despammed at virgilio.it
Tue May 25 12:57:51 EDT 2004
Jacek Generowicz <jacek.generowicz at cern.ch> writes:
>>>> def fib(n):
> ... if n<2: return 1
> ... return fib(n-1) + fib(n-2)
> ...
>>>> import time
>>>> a=time.time(); fib(35); time.time() - a
> 14930352
> 20.425565958023071
>
>
> Here are the results gathered in a table:
>
>
> Name Interpreted Compiled
>
> LispWorks 66 1.0 s
> Clisp 41 9.5 s
> CMUCL Got bored waiting 1.5 s
> SBCL Compiles everything 1.6 s
> Python Compiles everything 20 s
>
>
> So, we have times of 1.0s, 1.5s, 1.6s, 9.5s and 20s. Now one of those
> Common Lisp implementations does NOT compile to native; it compiles to
> bytecode. Can you guess which one it is, by looking at the timings ?
Using this code:
import psyco
psyco.full()
def fib(n):
if n<2: return 1
return fib(n-1) + fib(n-2)
import time
a=time.time()
fib(35)
print time.time()-a
I get 0.617813110352
The C version that you posted, using gcc 3.3.3 with -O3 option:
real 0m0.227s
user 0m0.208s
sys 0m0.001s
--
Valentino Volonghi aka Dialtone
Linux User #310274, Proud Gentoo User
Blog: http://vvolonghi.blogspot.com
Home Page: http://xoomer.virgilio.it/dialtone/
More information about the Python-list
mailing list