How Fast Does Python Run?

Jerome Quelin jerome.quelin at insalien.org
Thu Jun 15 18:11:52 EDT 2000


Hello,

>> I wonder if Python runs faster than Perl.
>Check out:
> http://wwwipd.ira.uka.de/%7Eprechelt/documents/jccpp_tr.pdf
>Which somebody posted here recently. Where the best Python was shown to 
>run faster than the best Perl, and the worst Python was shown to run a 
>/lot/ faster than the worst Perl. 

In this report, it is stated as one final conclusion that Python and
Perl are equivalent, with maybe an advantage for Perl :
[snip]
Within the script langages, Python and in particular Perl are faster than Rexx
and Tcl
[snip]


But the report also states that you can't issue conclusions on language speed,
advantages and drawbacks :
[snip]
For all program aspects investigated, the performance variability due to
different programmers (as described by the bad/good ratios) is about as large
or even larger than the variability due to different languages on average.
[snip]

So you can't tell which is faster between Perl or Python. Let's just stop those
flamewars.


I just would like say that I'm fond of Perl since a long long time, and if I
went to Python, it's mainly because I got frustrated with it when dealing with
larger applications.

I currently consider myself in a learning phase (even if I've already
read some books and tutorials on Python, and experienced a little with the
interpreter and made some very little scripts) since I have not applied it on
medium-size examples or on a real-world problem (in fact, I'm looking for an
idea of program I could work on, if you have any idea/suggestions...). This to
say that my opinion on Python may be a little inaccurate, but I hope it's not
too far from reality.

The point I wanted to underline is that different languages have different
scopes. And even if Perl and Python are really close, this doesn't mean they are
interchangeable.

I won't use Python for some tasks where Perl is (in my mind) the best suited.
For example, I think text processing is by far best handled by Perl with all
its text-oriented features (its native regular expression integration, the
facilities to handle files opening, reading and parsing, etc...) and the
short-cuts it provides (the Perl motto TIMTOWTDI).

And despite the fact I'm Perl addicted, I consider Python a lot better
for larger applications (and especially with GUI, since Perl/Tk isn't really
easy to handle - believe me ;-) ), due to its syntax, its OO model and the
readibility it procures.

But not for any kind of applications : you are to be clever enough to turn
yourself to C/C++ (or even ASM) if you need to perform low-levels operations on
your system, or to speed up your code.

Unless you are to develop a 1'000'000+ lines applications ? Then choose ADA or
another language that will allow you to manage your code efficiently...

Do not blindly choose Python just because you're Python addicted. Make your
choice with clever information. And if finally it appears that Python is the
best suited for the problem you want to solve, you will have the satisfaction to
know why (Q: "Why are you coding in Python ?" A: "Because it's the best."
Q: "And why is it the best ?" A: "Hermm....").

Sincerely,

Jerome
--
jerome.quelin at insalien.org






More information about the Python-list mailing list