scripting languages vs statically compiled ones
aleaxit at yahoo.com
Thu Oct 28 10:53:30 CEST 2004
Cameron Laird <claird at lairds.us> wrote:
> In article <mailman.5578.1098897981.5135.python-list at python.org>,
> Ajay <abra9823 at mail.usyd.edu.au> wrote:
> >is there an authoritative source on the performance of scripting languages
> >such as python vs. something like java, c, c++.
> >its for a report, so it would be awesome if i could quote some well-known
> >authority on this.
> Look for "premature optimization" in
> hoo.com > and <URL:
> hoo.com >
Heh -- thanks for the honor of quoting just me in this context, Cameron,
but I suspect Ajay would like something more.
I would recomment Prechelt's "An empirical comparison of C, C++, Java,
Perl, Python, Rexx, and Tcl",
published in IEEE's Computer magazine.
Summary of empirical results:
"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.
But, get and study the whole paper -- these conclusions need to be
studied in depth. E.g.: mostly, productivity is due to almost constant
LOC/hour, with scripting languages having median length (for given
problem) of 100 vs others' around 250, confirming "function point"
theory; however, looking at it with a finer grain shows LOC/hour
(median) as high as 40 for Python, as low as 20 for Java and Rexx (Rexx
results, like C ones, doubtful due to fewer programs under study).
I.e., in empirical practice under the experiment's conditions, the
Python program is not only less than half the size of the Java one doing
the same task, but also gets written almost 5 times as fast (a factor of
2 in lines/hour times a factor of 2.5 in program size for programs doing
the same task). Reliability of the different programs also matters, and
it tends to be higher for higher level languages (though the author
prudently says no more than 'no less reliable').
Of course, any such comparison of technologies happens _at one point in
time_, underscoring how silly it is to think one is able to compare
performance of _languages_ rather than their _implementation_ at a given
time. In the years since the experiment, the performance of Java and
Python implementations has increased, with substantial effort having
been put into optimizing the respective virtual machines (particularly
on intel-like processors; others, such as PPC, appear to have VMs that
are less highly optimized); I believe the other languages'
implementations have not changed significantly in performance terms.
Visiting http://shootout.alioth.debian.org/ and downloading and trying
the "shootout" -- needs a lot of ability for critical thinking and good
all around knowledge to fix a lot of issues, fairly pointed out but
unsolved in links from that page -- is another possibility.
More information about the Python-list