What makes the NaN check expensive?
What makes the NaN check expensive?
Posted Jan 5, 2020 20:12 UTC (Sun) by epa (subscriber, #39769)In reply to: What makes the NaN check expensive? by jansson
Parent article: Some median Python NaNsense
Moreover, if you are sorting the list then you are already doing an O(N log N) operation, so a linear scan to find any NaN values would be a tiny fraction of the total work on large lists, and for small lists it would be fast enough anyway not to matter. As others said you would not be using vanilla Python if you needed high-performance numeric operations. So I don’t understand the objections based on performance. Perhaps if you have vast numbers of short lists and need the median of each... but even then you’d surely use a different tool.
