ENH: __array_function__ updates for NumPy 1.17.0#12830
Conversation
- Always enable __array_function__ overrides. - Remove special cases for Python 2 compatibility. - Document these changes in 1.17.0-notes.rst. It will be good to see ASV numbers to understand the performance implications of these changes. If need be, we can speed up NumPy functions internally by using non-dispatched functions (with ``.__wrapped__``).
tylerjereddy
left a comment
There was a problem hiding this comment.
CI related changes LGTM
|
Thanks @shoyer |
@shoyer I'm just looking at the benchmarks, and noticed that this PR introduced fairly large regressions. Both in the That's more than I expected (it's up to 9x in the benchmarks, see https://pv.github.io/numpy-bench/#regressions?sort=3&dir=desc). Did you or anyone else look into this after the merge of this PR at any point? |
|
@rgommers That is indeed way more of a slow-down than I expected. But it looks like the actual slow-down from this PR for That said, 7us of overhead still seems like a lot. Running this on my machine, I see about 400 ns of overhead from dispatching. That's in approximately the expected range. There's a 2x slowdown, but there's definitely no nested dispatch going on: |
|
The slow down for the override benchmarks is to be expected from turning on overrides by default. Before this PR, those benchmarks weren't actually measuring anything at all. |
|
Thanks @shoyer
Yes, 400 ns is about the number I had in mind. Something odd about that benchmarking setup perhaps. Okay, so we're all good here:) |


It will be good to see ASV numbers to understand the performance implications
of these changes. If need be, we can speed up NumPy functions internally by
using non-dispatched functions (with
.__wrapped__).