Python is darn fast (was: How fast is Python)

Lawrence Oluyede raims at dot.com
Sat Aug 23 18:30:05 CEST 2003


Michele Simionato wrote:

> $ time p23 erf.py
> real    0m0.614s
> user    0m0.551s
> sys     0m0.029s
> 
> This is twice as fast as optimized C:
> 
> $ gcc erf.c -lm -o3
> $ time ./a.out
> real    0m1.125s
> user    0m1.086s
> sys     0m0.006s
>  
> Here is the situation for pure Python
> 
> $time p23 erf.jy
> real    0m25.761s
> user    0m25.012s
> sys     0m0.049s
> 
> and, just for fun, here is Jython performance:
> 
> $ time jython erf.jy
> real    0m42.979s
> user    0m41.430s
> sys     0m0.361s

Mmm...on my machine C is faster. What version of GCC do you have? I think
2.9x, right?

These are my timings (Debian GNU Linux Unstable, Duron 1300, Python2.3,
Psyco CVS, GCC 3.3.2, Java 1.4.1):

$ time python erf.py
                                                                                
real    0m0.251s
user    0m0.207s
sys     0m0.012s

$ gcc erf.c -lm -O3
$ time ./a.out
                                                                                
real    0m0.162s
user    0m0.157s
sys     0m0.001s

Notice that C is faster than Psyco + Python2.3 on my machine (about 65% of
speedup)

Without Psyco Python2.3 tooks about 6 seconds

$ time python erf.jy
 
real    0m6.177s
user    0m6.040s
sys     0m0.010s


And Jython is definitely slower :)

$ time jython erf.jy
 
real    0m10.423s
user    0m9.506s
sys     0m0.197s


-- 
Lawrence "Rhymes" Oluyede
http://loluyede.blogspot.com
rhymes at NOSPAMmyself.com




More information about the Python-list mailing list