NumPy Slow ??
olipt at mayo.edu
Tue Sep 19 00:17:27 CEST 2000
> Why is it that this line take ~30 sec to execute on a 500 MHz pentium III
> 128Meg RAM ?
> data1 = choose(greater(data,z2),(data,z2))
> where data is a 2048x2080 array of float and z2 is a float.
> I thought that NumPy functions where written in C for faster execution. Or
> maybe that I'm wrong and this is fast execution?
You are very likely creating a new 2048x2080 array of doubles (not floats)
with the comparison to a float (a Python float object is interpreted by
NumPy as a double). Some of the time is spent copying creating that new
Try setting the savespace property:
before you run that command to prevent this.
More information about the Python-list