summaryrefslogtreecommitdiff
path: root/doc/release/upcoming_changes/12065.performance.rst
blob: ff7605d3eb7de0e163483fce0e54f82197b6b4f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
Faster version of ``np.isin`` and ``np.in1d`` for integer arrays
----------------------------------------------------------------
``np.in1d`` (used by ``np.isin``) can now switch to a faster algorithm
(up to >10x faster) when it is fed two integer arrays.
The algorithm has similarities to a counting sort in that it
uses the ``ar2`` (``test_elements`` in ``np.isin``) argument to
index a boolean array, setting them to ``True`` where elements exist.
The ``ar1`` (``elements`` in ``np.isin``) argument then indexes
this array of booleans. Different memory scaling is also encountered,
and can be smaller or larger depending on configuration; this is described
in the docstring.