Re:WebKit sorts JS arrays using Selection Sort
by bdash on Friday July 13, 2012 @05:42PM
(#4242119)
Hmm… it looks like I misspoke. The "sparse mode" check that Array.prototype.sort performs in JavaScriptCore appears to be different than the its concept of sparse array storage, which is used under the conditions I described. The "sparse mode" check in the sorting code appears to be related to whether the array instance has getters/setters or properties defined via Object.defineProperty. The performance difference my code demonstrates is due to the extra overhead of iterating the sparse array storage compared to a vector, and not due to the different sorting algorithms that are employed.
[ Parent
| on HN ]
There are no comments on this comment yet.