[Numpy-discussion] Medians that ignore values

David Cournapeau david at ar.media.kyoto-u.ac.jp
Sun Sep 21 05:30:13 EDT 2008


David Cournapeau wrote:
>
> The isnan thing is surprising, because the whole point to have a isnan
> is that you can do it without branching. I checked, and numpy does use
> the macro of isnan, not the function (glibc has both).

Ok, see my patch #913 for this. The slowdown is actually specific to one
tested machine (my P4). On my macbook (running Mac os X) and another
linux machine running a core 2 duo, the performances are the same before
and after the patch. I have not tested on windows, though.

I also saw this mentioned:

http://projects.scipy.org/scipy/numpy/ticket/241

Where Travis made the same argument as me concerning NaN. It seems that
the slowdowns are not so significant, at least on the dataset I tested
(isnan is actually quite fast on my core 2 duo: 10 cycles / double for
large arrays on average, compared to the 60 / double on my P4 for the
exact same binary).

Travis, if you are reading this, would you reconsider your position on
nan handling for min/max/co if we can keep reasonable speed ?

cheers,

David



More information about the NumPy-Discussion mailing list