Python is faster than Java!!!

Mike Coffin mhc at Eng.Sun.COM
Wed Aug 16 23:54:11 EDT 2000


Martin Kew <Martin.Kew at vsl.com.au> writes:

> Now that you have read the catchy title go see
> 
> "An empirical comparison of C, C++, Java, Perl, Python,
> Rexx, and Tcl for a search/string-processing program" by
> Lutz Prechelt
> 
> at http://wwwipd.ira.uka.de/~prechelt/Biblio/
> 
> you be the judge!

Did you actually read this paper?  

Leaving aside questionable methodology, it doesn't even *purport* to
show anything like "Python is faster than Java."  If anything, it
seems to show that Java is slightly faster than Python overall.
The main conclusions as stated by the author: 

* As of JDK 1.2.1 (and on the Solaris platform), the memory overhead
  of Java is still huge compared to C or C++, but the run time
  efficiency has become quite acceptable.

* The often so-called "scripting languages" Perl, Python, Rexx, and
  Tcl can be reasonable alternatives to "conventional" languages such
  as C or C++ even for tasks that need to handle fair amounts of
  computation and data.  Their relative run time and memory
  consumption overhead will often be acceptable and they may offer
  significant advantages with respect to programmer productivity---at
  least for small programs like the phonecode problem.

* Interpersonal variability, that is the capability and behaviour
  differeneces between programmers using the same language, tends to
  account for more differences between programs than a change of the
  programming language.

But we really shouldn't leave aside the methodology. The author spends
almost four pages trying to justify the fairness of the comparison,
and finally has to admit that his methodology gave scripting languages
"advantages" over the other languages.  I think he's understating the
problem considerably.  Briefly, the problem is that the C, C++, and
Java programs were written by C.S. masters students who were told that
their main goal was to produce "correct" programs---no mention was
made of speed, memory, etc.  The scripting language programs were
submitted by volunteers from various usenet programming language
newsgroups.  Furthermore, the script programmers were given a broader
mandate; in particular, they were told that run-time performance was
as aspect of the programs.

-mike





More information about the Python-list mailing list