[Numpy-discussion] strange sin/cos performance

David Cournapeau cournape@gmail....
Tue Aug 4 10:20:13 CDT 2009


On Wed, Aug 5, 2009 at 12:14 AM, Andrew Friedley<afriedle@indiana.edu> wrote:

> Do you know where this conversion is, in the code?  The impression I got
> from my quick look at the code was that a wrapper sinf was defined that
> just calls sin.  I guess the typecast to float in there will do the
> conversion

Exact. Given your CPU, compared to my macbook, it looks like the
float32 is the problem (i.e. the float64 is not particularly fast). I
really can't see what could cause such a slowdown: the range over
which you evaluate sin should not cause denormal numbers - just to be
sure, could you try the same benchmark but using a simple array of
constant values (say numpy.ones(1000)) ? Also, you may want to check
what happens if you force raising errors in case of FPU exceptions
(numpy.seterr(raise="all")).

cheers,

David


More information about the NumPy-Discussion mailing list