ENH: avoid meshgrid and fancy indexing for 1d masked sort

Improves performance by using the simple indexing path and memory by
avoiding creating a full meshgrid.