summaryrefslogtreecommitdiff
path: root/numpy/array_api/_array_object.py
diff options
context:
space:
mode:
authorPieter Eendebak <pieter.eendebak@gmail.com>2023-02-15 16:59:07 +0100
committerGitHub <noreply@github.com>2023-02-15 16:59:07 +0100
commit4aca866c292eec899f75475ff14f7d5c1025e394 (patch)
tree7a17644cc618f6a88a4c116c685e4d78bdbe4423 /numpy/array_api/_array_object.py
parentda6cf855a5fa332781f1637775ab3cff1e12b86a (diff)
downloadnumpy-4aca866c292eec899f75475ff14f7d5c1025e394.tar.gz
ENH: Improve performance of finfo and _commonType (#23088)
The finfo contains a cache for dtypes, but the np.complex128 dtype does not end up in the cache. The reason is that the np.complex128 is converted to np.float64 which is in the cache. Performance improvement for finfo(np.complex128): Main: 2.07 µs ± 75 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each) Pr: 324 ns ± 28.9 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each) Improve performance of finfo by making the cache check the first action in the __new__ Improve performance of _commonType by re-using the expression for a.dtype.type and eliminating variables The finfo and _commonType was part of the computatation time in lstsq when using scikit-rf. Since these methods are used in various other methods performance can improve there slightly as well.
Diffstat (limited to 'numpy/array_api/_array_object.py')
0 files changed, 0 insertions, 0 deletions