Array emptying performance (v8)

Revision 8 of this benchmark created on


Setup

const arrayLength = 1000000;
const defaultValue = 1; // You can replace this with any default value you want

let a = new Array(arrayLength).fill(defaultValue);

Teardown

a += [1]

Test runner

Ready to run.

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

Revisions

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