diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2021-12-04 14:03:02 -0600 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2021-12-07 17:13:23 -0600 |
commit | 0353fef12215f4d5bb72389974905eb80f0984a8 (patch) | |
tree | c0b0f9812903a78b1be094082c8e935e8290c3c1 /numpy/array_api/_array_object.py | |
parent | 51d99b2a2746ac1ad16c1d2db8da8197e8200367 (diff) | |
download | numpy-0353fef12215f4d5bb72389974905eb80f0984a8.tar.gz |
PERF: Fix performance bug in dispatching cache
In promotion cases, the result of the dispatching was not cached
(at least not as well as it could be). This lead to large slowdowns
in cases where promotion is necessary, one example:
a = np.array([3]); b = np.array([3.])
%timeit a + b
The fix here is fairly small, and almost a cleanup, since I put the
whole `cache=True` logic in the wrong place really.
(I currently do not ever cache promoters, to be fair, this could
be done but should be unnecessary and may require a bit of thought.
Another thing that could be optimized is caching if there is no
matching loop to speed up error paths.)
Diffstat (limited to 'numpy/array_api/_array_object.py')
0 files changed, 0 insertions, 0 deletions