[Numpy-discussion] Speed degression?

Steffen Loeck steffen.loeck at gmx.de
Tue Jul 18 02:24:25 CDT 2006


> I also placed in hooks so you can replace the scalarmath (for int,
> float, and complex) with  the Python version of math (this works because
> the int, float, and complex scalars are sub-classes of the corresponding
> Python object).

Just for completeness some more tests using pythonmath/scalarmath for int, 
float or both (in usec per loop):

                            sin - array     mod - array    xx

(a) - (no import of numpy.core.scalarmath)

numpy 0.9.9.2800              152              76.5
numpy 0.9.9.2800 + math        50.2 


(b) - (use_pythonmath(xx))

numpy 0.9.9.2800              107              60.4       (int)
numpy 0.9.9.2800 + math        32.7 
 
numpy 0.9.9.2800              148              43         (float)
numpy 0.9.9.2800 + math        50.7 

numpy 0.9.9.2800              109              26.5       (int, float)
numpy 0.9.9.2800 + math        32.4 


(c) - (use_scalarmath(xx))

numpy 0.9.9.2800              149              77.1       (int)
numpy 0.9.9.2800 + math        50.7 

numpy 0.9.9.2800              147              74.3       (float)
numpy 0.9.9.2800 + math        50.7 

numpy 0.9.9.2800              148              73.5       (int, float)
numpy 0.9.9.2800 + math        50.8  


Maybe use_pythonmath(int, float, complex) should be set as default?

Many thanks,
Steffen




More information about the Numpy-discussion mailing list