why python is slower than java?

G. S. Hayes sjdevnull at yahoo.com
Fri Nov 5 14:03:44 EST 2004


Maurice LING <mauriceling at acm.org> wrote in message news:<418b166f$1 at news.unimelb.edu.au>...
> This may be a dumb thing to ask, but besides the penalty for dynamic 
> typing, is there any other real reasons that Python is slower than Java?

Personally, in practice I haven't found Python to be slower for real
apps, although it's sometimes an order of magnitude slower in
microbenchmarks.  That's probably because a lot of things that could
be slow (e.g. numerical manipulation) are backed by C modules behind
the scenes in Python; it's also very easy to refactor Python code,
which sometimes leads to massive algorithmic improvements.

I will say that I still have a tendency to write some projects in C
when they seem to warrant it (e.g. the mathematics and video portion
of my realtime music visualization system--the UI and database work is
in Python).

(I also found Java's I/O on our platform to be dog-slow back in the
JDK 1.3 days, but I've not used it for anything significant since
then.)



More information about the Python-list mailing list