I came across the following study, which compares various programming
languages for both productivity and performance. The programming
languages are broadly categorized into two sets: compiled and interpreted
(i.e. scripting languages). It's from 2000, so the languages involved may
have changed since, but it's a properly conducted study which draws
conclusions from both reason and statistical analysis.
An empirical comparison of C, C++, Java, Perl, Python, Rexx, and Tcl
Lutz Prechelt
http://page.mi.fu-berlin.de/prechelt/Biblio/jccpprt_computer2000.pdf
Summary and conclusions:
80 implementations of the same set of requirements are
compared for several properties, such as run time, memory
consumption, source text length, comment density, program
structure, reliability, and the amount of effort required for
writing them. The results indicate that, for the given programming
problem, which regards string manipulation and
search in a dictionary, scripting languages (Perl, Python,
Rexx, Tcl) are more productive than conventional languages
(C, C++, Java). In terms of run time and memory
consumption, they often turn out better than Java and
not much worse than C or C++. In general, the differences
between languages tend to be smaller than the typical differences
due to different programmers within the same language.
The following statements summarize the findings of
the comparative analysis of 80 implementations of the
phonecode program in 7 different languages:
Designing and writing the program in Perl, Python,
Rexx, or Tcl takes no more than half as much time as
writing it in C, C++, or Java and the resulting program
is only half as long.
No unambiguous differences in program reliability between
the language groups were observed.
The typical memory consumption of a script program is
about twice that of a C or C++ program. For Java it is
another factor of two higher.
For the initialization phase of the phonecode program
(reading the 1 MB dictionary file and creating the 70k-entry
internal data structure), the C and C++ programs
have a strong run time advantage of about factor 3 to
4 compared to Java and about 5 to 10 compared to the
script languages.
For the main phase of the phonecode program (search
through the internal data structure), the advantage in run
time of C or C++ versus Java is only about factor 2 and
the script programs even tend to be faster than the Java
programs.
Within the script languages, Python and in particular
Perl are faster than Tcl for both phases.
For all program aspects investigated, the performance
variability due to different programmers (as described
by the bad/good ratios) is on average about as large
or even larger than the variability due to different languages.
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
behavior differences between programmers using the
same language, tends to account for more differences
between programs than a change of the programming
language.
I wonder how J would have faired if it were included in the study. My bet:
in the top rank for productivity, and in the bottom for performance.
Maybe I'll take a crack at implementing the spec (though I'll need test
data).
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm