Internet Explorer and its inefficient sort implementation
This is just a quick post about how much IE team cares about JavaScript performances ...
Guess how many times Internet Explorer compare results? 17583 times, against a.length - 1 in other browsers.
Nice stuff guys, I guess for big arrays a manual reimplementation could perform better, am I wrong?
// generate an array of 1000 elements
var a = new Array(1000).join(",.").split(","),
calls = 0;
// call sort method incrementing the conter
a.sort(function(a, b){
++calls;
// return zero, nothing should change
return 0;
});
// discover the monster
alert(calls);
Guess how many times Internet Explorer compare results? 17583 times, against a.length - 1 in other browsers.
Nice stuff guys, I guess for big arrays a manual reimplementation could perform better, am I wrong?
Comments
Post a Comment