Empty array (v216)

Revision 216 of this benchmark created on


Setup

var sourceArray = [];
  
  for (i=0;i<100000;i++)
     sourceArray.push({a: 1, b: "2"});

Test runner

Ready to run.

Testing in
TestOps/sec
length
var arr = sourceArray.slice();

arr.length = 0;
ready
splice
var arr = sourceArray.slice();

arr.splice(0, arr.length);
ready
pop
var arr = sourceArray.slice();

while (arr.length > 0) {
  arr.pop();
}
ready
shift
var arr = sourceArray.slice();

arr=[]
ready

Revisions

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