How Fast Does Python Run?

Tim Rowe digitig at cix.co.uk
Fri Jun 16 19:34:00 EDT 2000


In article <961107112.124995831 at news.libertysurf.fr>, 
jerome.quelin at insalien.org (Jerome Quelin) wrote:

> In this report, it is stated as one final conclusion that Python and
> Perl are equivalent, with maybe an advantage for Perl :

Which is interesting, because that doesn't seem to be what the numbers 
show.

> 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'm reminded of the case many years ago, in the days when Rolls Royce 
didn't publish technical specs for their cars. Someone faxed them to ask 
what the horsepower of a roller was, and allegedly got back the fax 
"Adequate". I reckon that language -- or at least, compiler/interpreter 
speed /can/ be compared, and I think that paper did it the right sort of 
way, but I'm not much fussed by the results anyway. Last night I wrote 
some code to help my son with his maths homework. I was surprised by how 
quickly I got it working in Python, and pleased with how quickly it ran. 
Then I realised that it was a variation of the Knapsack problem, and so 
was NP complete! Fortunately there were not many items to deal with each 
time (6 or 7), but still, to be satisfied with the running time of an 
NP-complete program then I think Python's speed is "adequate"!

> 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....").

Yes, I argued the same in the Python/C flamewar recently. My favourite 
languages are Python, Ada and Eiffel, I'm competent in C++ and Pascal, and 
I do /most/ of my programming in Visual Basic, which I loathe but which is 
the best language for the task because the customer says that I /have/ to 
use it...



More information about the Python-list mailing list