Status: New
Owner: ----

New issue 2131 by [email protected]: Array.splice() slows down at arrays larger than 114467
http://code.google.com/p/v8/issues/detail?id=2131

I'm getting an astronomical difference in speeds for running splice(0,1) for arrays of lengths 114467 and 114468 respectively.

Running this benchmark:

var t;
function startBench(){t=new Date().getTime();}
function stopBench(){console.log(new Date().getTime()-t);}
var arr=[];
    for (var i = 114467; i > 0; i--) {
        arr.push([i - 1, i]);
    }
var arr2=[];
    for (var i = 114468; i > 0; i--) {
        arr2.push([i - 1, i]);
    }
startBench();
for(i=0;i<1000;i++){
arr.splice(0,1);
}

stopBench();
startBench();
for(i=0;i<1000;i++){
arr2.splice(0,1);
}
stopBench();


I get 3ms for the array of length 114467 and 2750ms for the array of length 114468.

Firefox gives 170ms for both, but that's irrelevant.

Is this a bug?

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to