Open
Description
For int16 arrays, intersect1d is faster for return_indices=True
than for return_indices=False
by quite a margin (6x on my computer). Is this behavior preferred? I would expect the opposite.
Reproducing code example:
import numpy as np
import timeit
D=20000
a1 = np.random.randint(0,10,D, dtype=np.int16)
a2 = np.random.randint(0,10,D, dtype=np.int16)
print(timeit.timeit(lambda: np.intersect1d(a1, a2, return_indices=False), number=100))
print(timeit.timeit(lambda: np.intersect1d(a1, a2, return_indices=True), number=100))