[Numpy-discussion] strange sin/cos performance
Chris Colbert
sccolbert at gmail.com
Mon Aug 3 12:23:13 EDT 2009
I get similar results as the OP:
In [1]: import numpy as np
In [2]: a = np.arange(0.0, 1000, (2*3.14159) / 1000, dtype=np.float32)
In [3]: b = np.arange(0.0, 1000, (2*3.14159) / 1000, dtype=np.float64)
In [4]: %timeit -n 10 np.sin(a)
10 loops, best of 3: 63.8 ms per loop
In [5]: %timeit -n 10 np.sin(b)
10 loops, best of 3: 10.8 ms per loop
In [6]: %timeit np.sin(a)
10 loops, best of 3: 63.6 ms per loop
In [7]: %timeit np.sin(b)
100 loops, best of 3: 8.85 ms per loop
machine:
ubuntu 9.04 AMD64
Intel Qx9300 @ 2.53
numpy 1.3 with Atlas 3.8.3
python 2.6.2
On Mon, Aug 3, 2009 at 11:17 AM, Keith Goodman<kwgoodman at gmail.com> wrote:
> On Mon, Aug 3, 2009 at 7:21 AM, Emmanuelle
> Gouillart<emmanuelle.gouillart at normalesup.org> wrote:
>>> >>>> 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?
>>
>> Sorry, I should have specified these information earlier:
>>
>> OS: Linux Ubuntu 9.04 (running a Dual Core Intel Pentium E5200 @
>> 2.50GHz)
>> Python: 2.6.2
>> Numpy: 1.2.1
>
> Why are my times so different from yours?
>
>>> 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: 46.8 ms per loop
>>> timeit -n 10 np.sin(b)
> 10 loops, best of 3: 7.43 ms per loop
>
> Ubuntu 9.04 on Core i7 920 (Quad 2.66GHz)
> Python 2.6.2
> Numpy 1.3.0
> And even though it is not used for this problem: ATLAS 3.8.3 (single threaded)
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
More information about the NumPy-Discussion
mailing list