loop in python
Steve Holden
steve at holdenweb.com
Mon Aug 22 16:33:40 EDT 2005
km wrote:
> Hi all,
>
> Why is it that the implementation of empty loop so slow in python when compared to perl ?
>
> #i did this in python (v 1.5)
> for x in xrange(1000):
> print x
> # this took 0.017 seconds
> --------------------------
> #similar code in perl (v 5.6):
> for $x (0..1000)
> {
> print $x;
> }
> # this took 0.005 seconds only !!!
>
> Is python runtime slow at all aspects when compared to perl ?
> I really wonder what makes python slower than perl ?
> Is there any proposal to make python faster in future versions ?
>
> curious to know all these ...
>
> regards,
> KM
>
If you want a fast language, try Holden. I've just invented it.
Unfortunately it gets the answer to every problem wrong unless the
answer is 42, but boy it runs quickly. The code for the whole
interpreter (it's written in Python) follows:
print 42
Why are you looking for a "fast language" without any regard for the
kind of problems you actually want (or need) to solve? Speed of
execution is so insignificant for the majority of programming problems
that this obsession reveals a certain inexperience.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
More information about the Python-list
mailing list