Is Python really slow?

Janne Sinkkonen janne at nnets.fi
Sat May 27 19:18:36 CEST 2000


Alexander <alecdem at mit.edu> writes:

> for k in xrange(1,100000000):
>    pass
> 
> and the same one in  C
> for ( i = 0 ; i < 1e8; i++ ) ;
> 
> and the second one seems to be working hundreds of times faster than the
> first one
> 
> Can I do anything with that.

Yes. 

If the efficiency of empty loops is important for you application, you
could write a C module which implements them.  See
http://www.python.org/doc/current/ext/ext.html for more information.

-- 
Janne



More information about the Python-list mailing list