Is python really slow?

Peter Hansen peter at engcorp.com
Thu May 23 00:44:14 EDT 2002


Lulu of the Lotus-Eaters wrote:
> 
> |Kragen Sitaker wrote:
> |> 1. Python is really slow, because it's highly dynamic and because it's
> |> interpreted.  This is true of Perl, too.  Primitive operations in both
> |> languages are roughly 100 to 1000 times slower than in languages
> |> compiled to machine code.
> 
> Peter Hansen <peter at engcorp.com> wrote previously:
> |From no doubt a very different background, my experience has shown the
> |number to be more in the range of 10 to 100 times slower, averaging
> |about 30 times.  In fact, the 100 times was usually with non-Pythonic
> |code, written with fairly heavy for-loops and lots of strings being
> |concatenated inefficiently.
> 
> I think Kragen and Peter are probably both right in their estimates,
> because they are talking about slightly different things.  If you just
> compare a raw loop, for example, C is easily 1000 times faster, e.g.

You're right.  I didn't catch the "primitive operations" part
of Kragen's post...  no doubt Python is up to 1000 times slower
doing little baby steps like that.

-Peter



More information about the Python-list mailing list