RESOLVED INVALID 110718
Array.prototype.sort is not quite stable
https://bugs.webkit.org/show_bug.cgi?id=110718
Summary Array.prototype.sort is not quite stable
Richard Gibson
Reported 2013-02-24 17:16:53 PST
The results of sorting length-N arrays for sufficiently large N appear to differ from a stable sort only at indices 0, 1, and N/2. It would be very convenient for Sizzle and jQuery if the sort were made fully stable, *especially* if such change lands in 537.32 so there's no release in which #108274 is fixed but this is not. Example with strings: http://jsfiddle.net/zTprj/1/ Example with DOM nodes: http://jsfiddle.net/vU2uB/ jQuery tickets: http://bugs.jquery.com/ticket/13505 http://bugs.jquery.com/ticket/13331
Attachments
Kyle Simpson
Comment 1 2013-02-24 17:42:47 PST
For reference, discussion thread for Chrome about this: http://code.google.com/p/v8/issues/detail?id=90 In particular, some people on the thread balk at stabilizing the sort because the spec for JS doesn't mandate stable sort (apparently wanting to give implementers more flexibility for performance sake).
Richard Gibson
Comment 2 2013-02-24 18:49:38 PST
Argh, forgive me for the misplaced report. WebKit handles this just fine; V8 is the inconsistent engine here. Moving discussion to their tracker.
Note You need to log in before you can comment on or make changes to this bug.