Push vs Unshift vs Iteration

Benchmark created on


Setup

const arr = new Array(10_000_000).fill(0);

Test runner

Ready to run.

Testing in
TestOps/sec
Push
arr.unshift(1);
ready
Unshift
for(const _ of arr){}
ready
Iterate
arr.push(1);
ready

Revisions

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