Performances of Pyhton programs

Frederic Giacometti frederic.giacometti at arakne.com
Mon Feb 18 18:40:25 EST 2002


"Christian Tanzer" <tanzer at swing.co.at> wrote in message
news:mailman.1014062970.17792.python-list at python.org...

Roy Smith <roy at panix.com> wrote:

> bairef2 at cti.ecp.fr (François Baire) wrote:
> > Are there any benchmark or does anoyone know what are the performances
of a
> > program written in python (in terms of CPU and RAM) compared with other
> > languages (especially C++ and compiled languages) ?
> >    I've met many articles which explain that python programs are slowler
> > because it uses the interpreter, but none says how much slower it is ! I
> > would like to know this for a rather big OO program which uses standard
> > fonctions of the language.
>
> There is little doubt that a program written in C/C++ will be faster than
> the same algorithm implemented in Python (or any of the common "scripting"
> languages such as Perl or TCL).  How much slower depends to a very large
> degree on exactly what you're doing.

+True, but misleading. A Python solution might use very different
+algorithms than a C/C++ solution. As the first working version of a
+Python solution is achieved much earlier than a C/C++ solution, there
+is a lot of time left to optimize if and where necessary.

+In my experience, a Python solution might be anywhere between 100
+times slower to 1000 times faster than a C/C++ solution.

But in practice, your python program does not work alone, but calls existin
C/C++ libraries, which will actually be doing significant computations or
database crunching, and Python only links to these (for instance, who would
even think of rewriting a Mesh solver in Python...).
This will be especially true in the 'large OO program' approach Francois
refers too.
In such situations, the overhead due to the Python solution to introduce
will be less or in the order of 10-30%, in a typical applicative context.

FG










More information about the Python-list mailing list