ENH: Use new argument parsing for array creation functions#18642
ENH: Use new argument parsing for array creation functions#18642mattip merged 5 commits intonumpy:mainfrom
Conversation
The array creation functions have the most to gain: 1. np.asarray is 4 times faster and commonly used. 2. Other functions are wrapped using __array_function__ in Python making it more difficult This commit (unfortunatly) has to do a few things: * Modify __array_function__ C-side dispatching to accomodate the fastcall argument convention. * Move asarray, etc. to C after removing all "fast paths" from np.array (simplifying the code) * Fixup imports, since asarray was imported directly in a few places * Replace some places where `np.array` was probably used for speed instead of np.asarray or similar. (or by accident in 1 or 2 places)
5d01d28 to
f531110
Compare
|
Looks good. Do the benchmarks confirm that this is more performant or are they about the same? I am a little concerned about possible unintentional behavior changes in the move from |
|
I could undo those, I did go through fairly carefully, my thought was just that it is more idiomatic and previously was likely a micro-optimization. Those calls had |
|
As a request: could you add a |
The argument name for the python side defined function was always `a` and not `object` so fix it and add a test. Also add a test to ensure the error paths are taken for all of the function. The missing NULL returns cannot be tested easily (but thanks to code coverage its nice to look at the uncovered stuff closer...)
I had forgotten that the docs for these functions where updated when rebasing.
|
Thanks @seberg |
The array creation functions have the most to gain:
making it more difficult
This commit (unfortunatly) has to do a few things:
the fastcall argument convention.
np.array (simplifying the code)
np.arraywas probably used for speedinstead of np.asarray or similar. (or by accident in 1 or 2 places)
Sorry, this should have been what was in gh-15270 :(. I split out those PRs from the "full" branch, and apparently picked the wrong commit the last time around.