Python 2 times slower than Perl

Christian Tanzer tanzer at swing.co.at
Thu Jul 19 02:44:12 EDT 2001


xucs007 at yahoo.com (Xu, C.S.) wrote:

> Just spent a little time to compare 4 stupid again algorithms
> (changed a little bit from last time) for both python and perl
> (codes attached) on two systems (SunOS and Linux):
> 	1. while loop, global variables
> 	2. for loop, global variables
> 	3. while loop, local variables (in function)
> 	4. for loop, local variables (in function)
> I used `time [1234].p[yl]` to get the time info. The user time
> is as follows:
> 
> PII 450MHz, Dell Precision 4100 Desktop, SunOS 5.8 i386
>                 #1      #2      #3      #4
> Python 2.1a1:   5.1     3.1     4.5     2.7
> Perl 5.005_03:  1.8     1.6     1.7     1.6
> 
> 
> PIII 1GHz, MTech 8500 Notebook, i386 Linux (Mandrake 8.0, kernal 2.4)
>                 #1      #2      #3      #4
> Python 2.0:     2.34    1.38    1.54    0.98
> Perl 5.6.0:     0.95    1.22    0.95    1.21
> 
> The closest match is on Linux, 0.98 (python#4) vs. 0.95 (perl#1,#3).
> Python still can't beat Perl, :-(  But I will continue to use Python
> to do uncritical data analysis, :-)

IMNSHO, your conclusion is not supported by your facts. You tested
nothing of importance to "critical" data analysis.

About the only thing you can safely conclude from your tests is that
you should continue to use Perl for trivial/meaningless tasks 
<3/4 wink>.

-- 
Christian Tanzer                                         tanzer at swing.co.at
Glasauergasse 32                                       Tel: +43 1 876 62 36
A-1130 Vienna, Austria                                 Fax: +43 1 877 66 92





More information about the Python-list mailing list