why python is slower than java?

Roger Binns rogerb at rogerbinns.com
Sat Nov 6 14:00:05 EST 2004


Alex Martelli wrote:
>         while ((c = in.read()) != -1)
>            out.write(c);

Incidentally, that Java code copies one character at a time.

> outputFile.write(inputFile.read())

The Python code is reading the entire string into memory and
then writing it.

The interpretter overhead vs system calls could be measured
by having the language involved in every byte transferred as
in the Java example, or negligibly as in the Python example.

Whenever anyone has an agenda, you can make all sorts of silly
claims.  IMHO the best thing to do is to lead by examples.
For years many people claimed Perl was line noise, hard to
maintain etc.  I never really saw much response, since the
Perl people were too busy writing real world code and helping
deliver part of the web revolution.  (And selling zillions of
books for O'Reilly :-)

I couldn't find any Python success stories on python.org itself,
but if you dig you can find the stories for the Python Business
Forum as well as Pythonology.

There are however remarkably few where you can go grab the
source code and see how it is all put together.  In fact I
couldn't find a single one, but didn't do an exhaustive
search from python.org.

Perhaps it is also worth linking to the projects done in
Python on SourceForge and elsewhere?

  http://sf.net/softwaremap/trove_list.php?form_cat=178

Roger 





More information about the Python-list mailing list