empty an array

Benchmark created on


Setup

var arr = [];
for (i = 0; i <= 10000; i++) {
  arr.push(Math.floor(Math.random() * 500))
}

Test runner

Ready to run.

Testing in
TestOps/sec
arr.length = 0
arr.length = 0
ready
arr.splice()
arr.splice(0, arr.length)
ready
arr.pop()
while(arr.length > 0) {
    arr.pop();
}
ready

Revisions

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