[Numpy-discussion] strange sin/cos performance

Keith Goodman kwgoodman@gmail....
Mon Aug 3 10:17:21 CDT 2009


On Mon, Aug 3, 2009 at 7:21 AM, Emmanuelle
Gouillart<emmanuelle.gouillart@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)


More information about the NumPy-Discussion mailing list