Array.push vs Array.unshift

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
push
  let arr = [];
  for(let i = 0; i < 100000; i++) {
    arr.push(Math.random());
  }
ready
unshift
  let arr = [];
  for(let i = 0; i < 100000; i++) {
    arr.unshift(Math.random());
  }
ready

Revisions

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