scripting languages vs statically compiled ones

John johng2001 at rediffmail.com
Thu Oct 28 23:29:52 EDT 2004


> 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.

Believe it :-). VB5 and VB6 can be compiled to native code and has
more or less identical performance to equivalent C code. And why
should not it? VBA implementation in VB is statically typed, well
optimized and not even as expressive as C. There is no kind of
developer productivity overhead like you see in Python :-). If your VB
code is running slower in VB6, chances are you are using variants and
other less optimizable features.

VBA in MS Office is interpreted (not even p-code) and your C dll will
improve performance a lot, but not much in VB5/VB6.

I actually benchmarked this 4 years ago. VB4 code ran 30 times slower
compared to when using a C dll. VB5 code ran at about the same speed
as C.

If I remember, there was also a benchmark in MSDN (back in 1998 or so)
which showed VB as native code running only 50% slower than C.

Vendors such as PowerBasic who sell native compiled BASIC variants
claim C or better than C performance.



More information about the Python-list mailing list