[Numpy-discussion] strange sin/cos performance

Emmanuelle Gouillart emmanuelle.gouillart@normalesup....
Mon Aug 3 12:09:32 CDT 2009


On Mon, Aug 03, 2009 at 08:17:21AM -0700, Keith Goodman wrote:
> 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



> >> 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

> Why are my times so different from yours?

No idea, sorry... All I can say is that I get similar results (around 11
and 12 ms per loop) with my other computer (wich has the same
Ubuntu/Python/Numpy configuration, and has 2 Intel T5600  @ 1.83GHz
CPUs).

Emmanuelle


More information about the NumPy-Discussion mailing list