WHY is python slow?

Thomas Wouters thomas at xs4all.net
Thu Jun 7 05:48:58 EDT 2001


On Thu, Jun 07, 2001 at 02:52:36PM +0700, Steven Haryanto wrote:

> Although it is generally accepted that Python is slower than
> Java/Perl/Ruby, a layman like me would be curious to know why
> exactly this is so. In other words, why is the implementation
> of a language like Ruby (which is on par with Python in terms
> of 'everything is an object', strong reflection, dynamic
> nature).

> My first guess would be the ubiquitous use of dictionaries?

As far as I know, Python dictionaries aren't particularly slow. I also have
no reason to believe that Perl is indeed structurally faster than Python,
excepting perhaps regular expressions and serious string munching. Tim has
stated before that idiomatic Python is faster than idiomatic Perl on his
machine (but then, that's Windows <wink>.)

I don't know that Ruby is faster than Python, but I know jack shit about
Ruby, so I can't say much about it. Java is faster probably because it was
designed to be almost-compilable. Python is a lot more dynamic than is Java,
and a compiler can take much less for granted.

That said, the biggest reason Java is faster than Python is probably the
money thrown into it. If someone was to fund Python the way Java has been
funded, who knows ;)

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list