Why I love python.

Dan Schmidt dfan at harmonixmusic.com
Fri Aug 13 21:12:31 CEST 2004


Nick Patavalis <npat at efault.net> writes:

| To cut the thread short, what I mean is that an application that has
| to do something like:
| 
|    for i in range(N):
|        a[i] = b[i] + c[i]
| 
| is bound to be 10 to 100 times slower than the equivalent coded in
| C.

Although note that (at least by my timing)

   a = map( operator.add, b, c )

is 3 times as fast as your Python version, bringing the code up to
being only 3 to 33 times slower than C.

I'm sure that pyrex could bring the speed up a heck of a lot more, too.

-- 
http://www.dfan.org



More information about the Python-list mailing list