FWIW in https://github.com/pandas-dev/pandas/issues/32339 I tried short-circuiting (left == right).all() with a naive cython implementation. In the cases that _dont_ short-circuit, it was 2x slower than np.array_equal.
On Wed, Apr 14, 2021 at 6:54 PM dan_patterson <dan_patter...@outlook.com> wrote: > a = np.zeros(1_000_000) > > a[100] = 1 > > %timeit np.any(a) > 814 µs ± 17.8 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each) > > %timeit np.any(a == 1) > 488 µs ± 5.68 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each) > > Haven't investigated further since your times are much longer than mine and > secondly the equality check for 1 implies that perhaps a short circuit > actually exists somewhere > > > > -- > Sent from: http://numpy-discussion.10968.n7.nabble.com/ > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@python.org > https://mail.python.org/mailman/listinfo/numpy-discussion >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@python.org https://mail.python.org/mailman/listinfo/numpy-discussion