|
|
Log in / Subscribe / Register

What makes the NaN check expensive?

What makes the NaN check expensive?

Posted Jan 7, 2020 18:43 UTC (Tue) by NYKevin (subscriber, #129325)
In reply to: What makes the NaN check expensive? by epa
Parent article: Some median Python NaNsense

You don't sort to get median, you do quickselect (or another algorithm), which is O(N) (in the average case).

(Granted, a linear scan for NaN is also O(N), and probably has a better cache hit rate to boot. So I agree with you that performance really shouldn't be a problem here.)


to post comments

What makes the NaN check expensive?

Posted Jan 7, 2020 22:06 UTC (Tue) by nivedita76 (guest, #121790) [Link]

You /should/, but the python implementation that's broken actually does a full sort.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds