Emptying an array (v33)

Revision 33 of this benchmark created on


Setup

var arr = new Array(20000);

Test runner

Ready to run.

Testing in
TestOps/sec
Setting .length to 0
arr.length = 0;
ready
Creating a new empty array
arr = [];
ready
Using .pop until .length is 0
while (arr.length) {
  arr.pop();
}
ready
Using .splice
arr.splice(0, arr.length);
ready

Revisions

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