Hi,
>>> a=N.random.poisson(N.arange(1e6)+1)
>>> U.timeIt('a**2')
0.59
>>> U.timeIt('a*a')
0.01
>>> a.dtype
int32
my U.timeIt function just returns the difference of time in seconds before and
after evaluation of the string.
For
>>> c=N.random.normal(1000, 100, 1e6)
>>> c.dtype
float64
i get .014 seconds for either c*c or c**2 (I averaged over 100 runs). After
converting this to float32 I get 0.008 secs for both.
Can the int32 case be speed up the same way !?
Thanks,
Sebastian Haase
|