ENH: Implement fastpath for masked indexes in join by phofl · Pull Request #50310 · pandas-dev/pandas (original) (raw)

As of right now, masked indexes go through object even though we only use the join functions when we are monotonic, e.g. no NA present. We can simply use the numpy array to perform the join.

       before           after         ratio
     [026a83e0]       [d804bced]
-     5.82±0.02ms      1.38±0.02ms     0.24  index_object.SetOperations.time_operation('monotonic', 'ea_int', 'intersection')
-     4.08±0.03ms         452±10μs     0.11  index_object.SetOperations.time_operation('monotonic', 'ea_int', 'union')

This is related to #49420, will make it a bit easier to review since it solves the join changes