[Numpy-discussion] strange sin/cos performance
Hans Meine
meine@informatik.uni-hamburg...
Tue Aug 4 13:46:39 CDT 2009
On Tuesday 04 August 2009 19:19:22 Andrew Friedley wrote:
> OK, have some interesting results. First is my array creation was not
> doing what I thought it was. This (what I've been doing) creates an
> array of 159161 elements:
>
> numpy.arange(0.0, 1000, (2 * 3.14159) / 1000, dtype=numpy.float32)
Aaaaah. And I wondered why taking the sin/cos of 1000 elements took so
long... ;-) (actually, I would've used larger arrays for benchmarking to
begin with)
Indeed, the value range fixes stuff here (Linux, GCC/amd64, Xeon X5450 @
3.00GHz, NumPy 1.3.0), too:
Before:
float64 10 loops, best of 3: 54.2 ms per loop
float32 10 loops, best of 3: 7.62 ms per loop
After:
float64 10 loops, best of 3: 6.03 ms per loop
float32 10 loops, best of 3: 3.81 ms per loop
Best,
Hans
More information about the NumPy-Discussion
mailing list