[Numpy-discussion] strange sin/cos performance
Andrew Friedley
afriedle@indiana....
Mon Aug 3 09:10:27 CDT 2009
Emmanuelle Gouillart wrote:
> Hi Andrew,
>
> %timeit is an Ipython magic command that uses the timeit module,
> see
> http://ipython.scipy.org/doc/stable/html/interactive/reference.html?highlight=timeit
> for more information about how to use it. So you were right to suppose
> that it is not a "normal Python".
Thanks for the pointer, I'm not familiar with IPython at all, will check
it out.
> However, I was not able to reproduce your observations.
>
>>>> import numpy as np
>>>> a = np.arange(0.0, 1000, (2 * 3.14159) / 1000, dtype=np.float32)
>>>> b = np.arange(0.0, 1000, (2 * 3.14159) / 1000, dtype=np.float64)
>>>> %timeit -n 10 np.sin(a)
> 10 loops, best of 3: 8.67 ms per loop
>>>> %timeit -n 10 np.sin(b)
> 10 loops, best of 3: 9.29 ms per loop
OK, I'm curious, what OS/Python/Numpy are you using?
Andrew
More information about the NumPy-Discussion
mailing list