Is this really faster than reusing some off-the-shelf sort such as `np.argsort` or `qsort`? It looks like a rather naive quicksort (no random pivoting, median-of-three rule, back-off to insertion sort, ...).