[Numpy-discussion] Speed degression?

Steffen Loeck steffen.loeck at gmx.de
Tue Jul 4 09:19:24 EDT 2006


Hi all,

i made some speed tests using the sin-function and the %-operation to compare 
Numeric, numpy 0.9.8 and numpy 0.9.9.2732. 
As result the latest numpy version seems to be very slow in comparison to the 
two other candidates.

Results (in usec per loop):
                                     sin-array            mod-array  
                                    
 Numeric                                134                   18         
  
 numpy 0.9.8                             97                   55

 numpy 0.9.9.2732                       204                  316
   
 numpy 0.9.8 + math                      38

 numpy 0.9.9.2732 + math                161
  
 Numeric + math                          23


The used scripts can be found at the end. 

Can anyone verify my results and explain the observed speed degression?

Thanks,
Steffen


sin-scripts:

/usr/lib/python2.3/timeit.py -s "from Numeric import sin,zeros,arange; 
x=zeros(10, 'd'); x[0]=0.1" "for i in arange(9): x[i+1]=sin(x[i])"
 
/usr/lib/python2.3/timeit.py -s "from numpy import sin,zeros,arange; 
x=zeros(10, 'd'); x[0]=0.1" "for i in arange(9): x[i+1]=sin(x[i])"
 
/usr/lib/python2.3/timeit.py -s "from math import sin; from numpy import 
zeros,arange; x=zeros(10, 'd');x[0]=0.1" "for i in arange(9): 
x[i+1]=sin(x[i])"

/usr/lib/python2.3/timeit.py -s "from math import sin; from Numeric import 
zeros,arange; x=zeros(10, 'd'); x[0]=0.1" "for i in arange(9): 
x[i+1]=sin(x[i]
)"


%-scripts

/usr/lib/python2.3/timeit.py -s "from Numeric import zeros,arange; x=zeros(10, 
'd'); x[0]=0.1" "for i in arange(9): x[i+1]=(x[i]+1.1)%(1.0)"
 
/usr/lib/python2.3/timeit.py -s "from numpy import zeros,arange; x=zeros(10, 
'd'); x[0]=0.1" "for i in arange(9): x[i+1]=(x[i]+1.1)%(1.0)"




More information about the NumPy-Discussion mailing list