why python is slower than java?

Ian Bicking ianb at colorstudy.com
Sun Nov 7 11:45:37 CET 2004


Israel Raj T wrote:
> Kendall Clark <kendall at monkeyfist.com> writes:
> 
> 
>> The main reason Java is "faster" is because
> 
> 
> I would reject the premise entirely.
> 
> When looking at desktop apps made with Python, they positively whiz
> when compared to Java swing apps.

Let's give a shout out to the GIL!  Woo GIL!  More seriously, I'd give
up Java's theoretical thread scalability any day in return for the ease
of Python's C API.  Not that I've tried to code a C extension for either
language; but I get the impression the GIL is an important part of
making Python easy to use, and I frequently take advantage of the
extensions other people have written, and I'm betting there'd be less of 
them without the GIL.  They seem uncommon in Javaland.

> As for non desktop apps, the entire portage system of Gentoo is
> written in Python. 'emerge sync' causes a python app to synchronise a
> local application database with database at a non-local mirror. It is
> i/o intensive and appears to work very well and very fast.

Here, I'm betting it's fast because of a good implementation; because 
emerge can avoid doing work, rather than obsessing about doing the work 
quickly.  For something like emerge, there's huge potential in caching, 
dependency checking, and generally being smart about the tradeoffs. 
This will apply to any program that uses the network, a database, large 
files, or any of those other time sinks that easily outweigh CPU 
performance.  If you can get the job done in Python in half the time (or 
better), that gives you more time to make the application faster.

-- 
Ian Bicking  /  ianb at colorstudy.com  / http://blog.ianbicking.org



More information about the Python-list mailing list