(bug 35526) Make jquery.tablesorter use a stable sort
authorBrad Jorsch <anomie.wikipedia@gmail.com>
Fri, 13 Jul 2012 18:56:17 +0000 (14:56 -0400)
committerBrad Jorsch <anomie.wikipedia@gmail.com>
Thu, 2 Aug 2012 20:01:25 +0000 (16:01 -0400)
commitfda9110f5a493868f26f9c6075eeeeac23ec161d
tree3300611045be4b54d81a410d6a9d9a3dd734097c
parentca2b80b9c272f4a7e49461875e907680632de7ce
(bug 35526) Make jquery.tablesorter use a stable sort

In r86337, jquery.tablesorter was changed from using the standard
Javascript Array.sort to a custom merge sort, with the justification
that it eliminates an eval and merge sort is stable. However, the
implementation used is not, in fact, stable, and making an in-place
merge sort stable reportedly kills performance.

Instead, let's just go back to using Array.sort, but with a closure
(basically the same comparison function used by the merge sort) rather
than an eval and using the already-calculated "position" as a tiebreaker
when two rows are otherwise equal to make it stable.

Change-Id: Idc50127d3bfec2b1727f397a9780b359fd56055e
RELEASE-NOTES-1.20
resources/jquery/jquery.tablesorter.js
tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js