push vs unshift (v2)

Revision 2 of this benchmark created by Jonas Fischer on


Setup

var a;
  
  
  Benchmark.prototype.setup = function() {
   a = [];
  }

Test runner

Ready to run.

Testing in
TestOps/sec
push
a.push('x');
ready
array empty ...
if (a != []) a = [];
ready
unshift
a.unshift('x');
ready

Revisions

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

  • Revision 2: published by Jonas Fischer on