Is Python really slow?

Michael Hudson mwh21 at cam.ac.uk
Sat May 27 05:59:36 EDT 2000


Alexander <alecdem at mit.edu> writes:

> Hi
> 
> I have implemented  loop in Python
> 
> 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.

Well, it's an empty loop so it's pretty useless to all mankind.

Is this /just/ a troll, or has Python's (relative) lack of speed
bothered you?  Yes, C can spin empty loops faster (especially if the
optimiser removes the loop entirely...), but for doing most
significant things, the difference is much less noticeable.

Cheers,
Michael

-- 
  The "of course, while I have no problem with this at all, it's
  surely too much for a lesser being" flavor of argument always rings
  hollow to me.  Are you personally confused by the meanings for "+"
  that exist today?                         -- Tim Peters, 29 Apr 1998



More information about the Python-list mailing list