Speed of Python vs. Perl 
Author Message
 Speed of Python vs. Perl

FYI: This is from comp.lang.python.

If someone is looking for something interesting to do, this might give you
some ideas.

Quote:

> [Tim]
> > Indeed, on my box, I can clearly see the difference between:
> >     python -c "print 'hi'"
> > and
> >     perl -e "print 'hi'"
> > by eyeball (the former takes a noticeable fraction of a second;
> > the latter appears instantaneous).

> [Skip Montanaro]
> > Then you have better reflexes than anyone suspected

> There you go, projecting your limitations onto others again <wink>.

> > or you need a better box (I thought you had a 700+ MHz thingamabob)...

> That was on a 866MHz P3, 256Mb RAM, Win98SE.  I've seen this for
> approximately 10 years, though, on all sorts of boxes.

> > On my box (being similarly vague), the time command shows no
> > more than 0.04sec user time for the python command and no more
> > than 0.01sec user time for the perl command (even after
> > adding a \n to make them truly comparable ;-).

> Like everything else, it varies by platform and configuration.  I'm
> not keen to dig into the details on either of our boxes, though --
> like I said, it's been discussed on c.l.py many times already.  Last
> time it popped on Python-Dev (via Greg Stein), Greg Ward reported
> these stats on the number of system calls at startup, obtained via
> running truss/strace/par on assorted Unix variants:

> Total:
>                Solaris     Linux    IRIX[1]
>   Perl              88        85      70
>   Python           425       316     257

> Number of "open" calls:
>                Solaris     Linux    IRIX
>   Perl             16         10       9
>   Python          107         71      48

> Number of unsuccessful "open" calls:
>                Solaris     Linux    IRIX
>   Perl              6          1       3
>   Python           77         49      32

> Number of "mmap" calls:
>                Solaris     Linux    IRIX
>   Perl              25        25       1
>   Python            36        24       1

> Number of "brk" calls:
>                Solaris     Linux    IRIX
>   Perl               6        11      12
>   Python            47        39      25

> > Still, the machine seems to think that Python is slower than Perl
> > at startup even though I can't tell...

> Write a little shell loop, and count how *many* times you can start
> each in, say, a grand total of 10 seconds (that's a crude model of
> what people who claim to care about this are concerned about).  Then
> do it again adding "-S" to your python line.  You may (or may not
> <0.5 wink>) discover something interesting on your box.

> > of-course-it-could-be-a-windows-/-linux-thing-jab-jab-ly y'rs,

> Absolutely.  Python on Windows goes crawling thru the registry too,
> and is *always* built from dynamic libraries (python.exe is under
> 24Kb on Windows -- it's not like running that alone can accomplish
> much <wink>).

> "startup"-covers-a-world-of-activities-all-by-itself-ly y'rs  - tim

Conrad Schneiker
(This note is unofficial and subject to improvement without notice.)


Sun, 06 Jul 2003 15:49:28 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Speed of Python vs. Perl

2. Perl speed vs. Python speed

3. Speed problems with Python vs. Perl

4. Yet another Python vs. Perl speed issue/question

5. python vs. perl speed comparisons

6. Python vs Perl: benchmarking for speed?

7. Perl vs TCL (was: Execution speed of Perl?)

8. Python Binding [Was: Re: PYTHON VS. PERL VS. TCL ]

9. Forth vs Python vs Perl

10. perl vs python vs icon

11. PYTHON VS. PERL VS. TCL

12. jredford's flames and criticism (was: PYTHON VS. PERL VS. TCL )

 

 
Powered by phpBB® Forum Software