[Numpy-discussion] another performance problem

Gerard Vermeulen gerard.vermeulen at grenoble.cnrs.fr
Sun Jan 29 10:14:04 CST 2006


Hi Travis,

max and min are really slow in numpy:

>>> from timeit import Timer
>>> import Numeric; Numeric.__version__
'23.1'
>>> import numarray; numarray.__version__
'1.2.3'
>>> import numpy; numpy.__version__
'0.9.5.2021'
>>> t1 = Timer('a = max(b)', 'import Numeric as N; b=N.cos(N.arange(0, 10**5, 1, N.Float))')
>>> t2 = Timer('a = max(b)', 'import numarray as N; b=N.cos(N.arange(0, 10**5, 1, N.Float))')
>>> t3 = Timer('a = max(b)', 'import numpy as N; b=N.cos(N.arange(0, 10**5, 1, N.Float))')
>>> t1.timeit(10)
0.13748002052307129
>>> t2.timeit(10)
0.64549708366394043
>>> t3.timeit(10)
4.5433549880981445
>>>

Gerard




More information about the Numpy-discussion mailing list