how fast is Python?
Mark Carter
cartermark46 at ukmail.com
Thu Aug 21 08:13:36 EDT 2003
> > However, there are definitely cases where a lot of code would need to
> > be optimized, and so I ask the question: How fast is Python, compared
> > to say a typical optimizing C/C++ compiler?
I did a benchmark some time ago (nothing optimised):
PURPOSE:
The purpose of this technical report is to gauge the relative speed of
the languages: VB, VBA, Python 2.2, C++, and Fortran.
SUMMARY RESULTS:
It was discovered that uncompiled VB code in VB 6.0 ran at the same
speed as VBA code in Excel. It was half the speed of compiled VB code,
5 times the speed of Python, and 1/20th the speed of C++/Fortran.
METHOD:
The following algorithm was implemented in each of the target
languages:
X = 0.5
For I = 1 to 108
X = 1 X* X
Next
Timings were made for the execution. The following results were
obtained:
Language Timing (seconds)
VB uncompiled 74
VB compiled 37
VBA Excel 75
Python 401
C++ - debug version 4
C++ - release version 3
Fortran 3
The timings for Fortran are approximate. The execution time had to be
timed with a stopwatch because timing functions could not be
discovered.
More information about the Python-list
mailing list