Perl code 37 times quickly than Python code??

Garry Hodgson garry at sage.att.com
Wed Jan 16 09:30:22 EST 2002


Toni Gaya wrote:

> And YES, this isn't a complete benchmark. But I think is a representative
> example. I like programing in Python, but it seems that Python people are
> always looking to speed things and do things in "strange forms or manner".

the responses i've seen haven't done things in "strange forms or
manner".
they've corrected a bug in your perl code, and used the more efficient,
and
more common range() vs. xrange(), thus correcting your "strange forms or
manner".
as andrew dalke has pointed out, it doesn't.

> Why a example as simple as that runs many times quickly in perl than python? it
> doesn't have explication. Two programs syntax are clear and simple....

as others have pointed out, they run at about the same speed.

> I expect this post will not to be a "war" between what language is better. I
> have write this article for make a better python, a quick python that don't
> need usage "strange syntax" (= bad programming) that people use to make quick
> programs.

it would appear that this is not a problem.

this kind of thing comes up all the time.  someone finds a code fragment
that runs faster in perl (or whatever), and posts a "why is python so
slow?"
thread.  more reliable benchmarks suggest that python is on par with its
competition.
faster for some things, slower for others.  if you need speed, go with a
compiled language.

-- 
Garry Hodgson                   Let my inspiration flow
Senior Hacker                      in token rhyme suggesting rhythm
Software Innovation Services    that will not forsake me
AT&T Labs                          'til my tale is told and done.
garry at sage.att.com



More information about the Python-list mailing list