sorting `idx` has a reasonable possibility in reducing runtime by better taking advantage of data locality when subsetting