Array.prototype.sort is now stable in @v8js v7.0 / Chrome 70! 🎉 Previously, V8 used an unstable QuickSort for arrays with more than 10 elements. Now, we use the stable TimSort algorithm. Demo: mathiasbynens.be/demo/sort-stab…
38
582
2K
0
25
Download Image
Although not technically a spec violation, stable sort was one of the oldest and most popular developer requests in our @v8js bug tracker (issue #90!): bugs.chromium.org/p/v8/issues/de… Kudos to @nimODota for making it happen!
Fingers crossed @ChakraCore eventually switches to a stable sorting algorithm, too. Then we could update the Array.prototype.sort spec to require stability and call it a day. One can dream… (@ChakraCore’s sort is currently only stable for arrays with 512 or fewer elements.)