Remove extra copy from sortperm
Merge pull request #2172 from kmsquire/faster_sortperm

Remove extra copy from sortperm