Optimized sorting (when using data-sort-value attributes)

Sorting itself was fast but the for/while loops in sort_map() were slow.
I found it faster to group sort data + TR references into a tuple, sort
the tuple array and then use the TR reference to append the rows back.