[SciPy-dev] Indexing array performance
Francesc Altet
faltet at carabos.com
Sat Dec 31 06:15:31 CST 2005
Hi,
I'm doing some timings on array indexing feature. It's quite shocking
to me that, provided empty() and arange() are faster in scipy_core
than its counterparts in numarray:
In [110]: t1 = timeit.Timer('a=empty(shape=10000);a=arange(10000)','from
scipy.base import empty, arange')
In [111]: t1.repeat(3,10000)
Out[111]: [0.74018502235412598, 0.76141095161437988, 0.71947312355041504]
In [112]: t2 = timeit.Timer('a=array(None,shape=10000);a=arange(10000)','from
numarray import array, arange')
In [113]: t2.repeat(3,10000)
Out[113]: [2.3724348545074463, 2.4109888076782227, 2.3820669651031494]
however, the next code seems to be slower in scipy_core:
In [114]: t3 = timeit.Timer('a=empty(shape=10000);a[arange(10000)]','from
scipy.base import empty, arange')
In [115]: t3.repeat(3,1000)
Out[115]: [3.5126161575317383, 3.5309510231018066, 3.5558919906616211]
In [116]: t4 = timeit.Timer('a=array(None,shape=10000);a[arange(10000)]','from
numarray import array, arange')
In [117]: t4.repeat(3,1000)
Out[117]: [2.0824751853942871, 2.1258058547973633, 2.0946059226989746]
It seems like if the index array feature can be further optimized in
scipy_core.
--
>0,0< Francesc Altet http://www.carabos.com/
V V Cárabos Coop. V. Enjoy Data
"-"
More information about the Scipy-dev
mailing list