Empty array (v81)

Revision 81 of this benchmark created on


Setup

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

Test runner

Ready to run.

Testing in
TestOps/sec
length
arr.length = 0;
ready
splice
arr.splice(0, arr.length);
ready
pop
var l = arr.length;
while (l > 0) {
  arr.pop();
  l--;
}
ready
shift
var l = arr.length;
while (l > 0) {
  arr.shift();
  l--;
}
ready
Assign new array
arr = [];
ready

Revisions

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