Python's Performance

Phillip J. Eby pje at
Sat Oct 8 19:14:25 CEST 2005

Laszlo Zsolt Nagy wrote:
> Dave wrote:
> > Hello All,
> >
> > I would like to gather some information on Python's runtime
> > performance. As far as I understand, it deals with a lot of string
> > objects. Does it require a lot string processing during program
> > execution? How does it handle such time-consuming operations? Is there
> > a way to find out how many string operations (perhaps in the
> > underlying system) ) it does during program execution?
> Do you want to know how many internal string operations are done inside
> the Python interpreter? I believe it is not a useful information. There
> are benchmarks testing the *real performance* of Python.
> For example:

Actually, that benchmark shows something rather interesting.  The C and
Java versions of the benchmark are much faster than Python on so-called
"64-bit arithmetic", but only Python computes the *correct* answer to
the benchmark!  The others overflow 64 bits at some point and lose
precision, resulting in a nonsense result that the author failed to

So, without meaning to, the benchmark author has demonstrated something
important about Python, which is that writing the obvious thing in
Python tends to work correctly, even if it sometimes takes longer to
run than it would take for another language to produce the wrong
answer.  :)

More information about the Python-list mailing list