Please Login to reply.
could be optimized by making the array global and constant, so it does not have to be created again each time.
Would also have to be immutable somehow, otherwise an earlier caller could modify it and it wouldn’t be sorted anymore.
you can always trust the user to not misuse your libraries...