delete is slow (v13)

Revision 13 of this benchmark created by ashish on


Setup

var arr = [1,2,3,4,5,6];
    var arrDeleted = [1,2,3,4,5,6];
    var arrSpliced = [1,2,3,4,5,6];
    
    delete arrDeleted[3];
    arrSpliced.splice(3,1);

Test runner

Ready to run.

Testing in
TestOps/sec
delete
for(var i = 0; i < arrDeleted.length; i++){
  console.log(arrDeleted[i]);
}
ready
no delete
for(var i = 0; i < arr.length; i++){
  console.log(arr[i]);
}
ready
spliced
for(var i = 0; i < arrSpliced.length; i++){
  console.log(arrSpliced[i]);
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.