[Numpy-discussion] strange sin/cos performance

Dave dave.hirschfeld@gmail....
Wed Aug 5 02:40:04 CDT 2009


Charles R Harris <charlesr.harris <at> gmail.com> writes:

> 
> 
> Is anyone with this problem *not* running ubuntu?Chuck 
> 

All I can say is that it (surprisingly?) doesn't appear to affect my windoze
(XP) box.


Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)]

In [2]: a=np.random.rand(10000).astype(np.float32)

In [3]: b=np.random.rand(10000).astype(np.float64)

In [4]: c=1000*np.random.rand(10000).astype(np.float32)

In [5]: d=1000*np.random.rand(1000).astype(np.float64)

In [6]: timeit -n 10 np.sin(a)
10 loops, best of 3: 442 us per loop

In [7]: timeit -n 10 np.sin(b)
10 loops, best of 3: 513 us per loop

In [8]: timeit -n 10 np.sin(c)
10 loops, best of 3: 474 us per loop

In [9]: timeit -n 10 np.sin(d)
10 loops, best of 3: 63.1 us per loop

In [10]: timeit -n 10 np.sin(c.astype(np.float64)).astype(np.float32)
10 loops, best of 3: 587 us per loop

In [11]: !gcc --version
gcc (GCC) 3.4.5 (mingw-vista special r3)





More information about the NumPy-Discussion mailing list