scripting languages vs statically compiled ones

beliavsky at aol.com beliavsky at aol.com
Thu Oct 28 13:04:05 EDT 2004


Ajay <abra9823 at mail.usyd.edu.au> wrote in message news:<mailman.5578.1098897981.5135.python-list at python.org>...
> hi!
> 
> 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.

Table 25-1, "Relative Execution Time of Programming Languages", on
page 600 of the book "Code Complete, 2nd Edition" by Steve McConnell
(a well-known author) has the following statistics, based on
benchmarks described by the author in chapters 25-26. A larger number
means the language is slower.

Language       Type of Language     Execution Time Relative to C++
C++            compiled             1
Visual Basic   compiled             1
C#             compiled             1
Java           byte code            1.5
PHP            interpreted          >100
Python         interpreted          >100

I think Python is slower than C++ or Fortran for number-crunching,
based on some experience with Numeric, but the speed factor is more
often in the range of 2-10, not >100. McConnell's benchmarks are more
general. I doubt the assertion that VB is as fast C++. Replacing a VBA
function in Excel with a C dll can lead to big increase in speed.

Table 4-1 of the same book shows the "ratio of high-level-language
statements to
equivalent C code" (higher is better):

Language                Language Relative to C
C                       1
Fortran 95              2
C++                     2.5
Java                    2.5
Microsoft Visual Basic  4.5
Perl                    6
Python                  6

The ratios depend heavily on the type of program being written. I'll
believe a VB/Fortran 95 ratio of 2.25 (or much higher) for Windows GUI
programming but not for a linear algebra library, where Fortran is
more powerful.

The sources listed for this table are the books

"Estimating Software Costs", by Capers Jones, McGraw-Hill (1998)

"Software Cost Estimation with Cocomo II" by Barry Boehm,
Addison-Wesley
(2000)

and the paper (online at
http://page.mi.fu-berlin.de/~prechelt/Biblio/jccpprt_computer2000.pdf
)

"An Empirical Comparison of Seven Programming Languages", by Lutz
Prechelt,
IEEE Computer, October 2000, 23-29.



More information about the Python-list mailing list