[Numpy-discussion] Speed degression?
Travis Oliphant
oliphant at ee.byu.edu
Thu Jul 6 16:49:53 CDT 2006
Arnd Baecker wrote:
>Bingo! Only numpy 0.9.9.2749 + math is slower than
>Numeric+math by a factor 1.6 and mod-array is 2.5 times slower
>than numpy.
>It would be nice if you could have a look at the module operation,
>if possible ...
>
>
O.K. I looked at how Python computed modulo and implemented the same
thing for both umath (the remainder function) and scalarmath.
The result is a significant speed up for modulo...yeah...
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).
import numpy.core.scalarmath as ncs
# Replace "scalarmath" with standard Python arithmetic.
ncs.use_pythonmath(<int | float | complex>)
# Replace "scalarmath" with actual scalarmath code.
ncs.use_scalarmath(<int | float | complex>)
This can test the speed of the implementations.
-Travis
More information about the Numpy-discussion
mailing list