For anyone still interested:
I am working on a package that implements a very similar appoach to speedup sortperm:
By using StructArrays it is not only faster, but also more general, i.e. it works with arrays of all types.
I am very happy with the results so far. But before listing the package publicly, some more polishing is required.
I wonder if this would be convertible to
sortperm!?
You will be happy so know that SimultaneousSortperm implements not only ssortperm!(ix,v), but also ssortperm!(v) and ssortperm!!(ix,v), which sort the input vector too, and thereby manage to use O(1) extra space instead of O(n).
Here are some benchmarks on my AMD 3900x with DDR4-3600 CL 16 memory. Note that the advantage of this approach is even greater when using (regular) memory with higher latency.
Benchmarks







