why python is slower than java?

Mike Meyer mwm at mired.org
Fri Nov 5 21:34:52 EST 2004


finite.automaton at gmail.com (Lonnie Princehouse) writes:

> Yes, wxPython is typically quicker than swing.  It's not fair to use
> this in a generic Python-vs-Java speed shootout, though, since
> wxPython is just a wrapper around wxWidgets' C++ code; you're really
> comparing C++ vs. Java here.

Is it unfair to compare Python dictionaries to Java HashTables because
Python is using hand-tuned C where Java is using Java? I'd say that's
a perfectly fair comparison. If that's fair, what's unfair about
comparing graphics toolkits that happen to be written in C rather than
Python (is there a graphics toolkit written in Python?).

That's *how* interpreted languages manage to compete with compiled
languages - they perform the common operations in hand-tuned compiled
code. That people tend to write Java libraries in Java rather than C
just means they're going to get slower libraries.

> AFAIK the major two reasons for Python's relative slowness are that
> it's interpreted and dynamically typed.

Java is interpreted just like Python is. The only difference is that
Java splits the compiler and VM implementation into two different
binaries.

        <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list