push/pop vs unshift/shift (v17)

Revision 17 of this benchmark created by test on


Preparation HTML

<script>
  var pl = ['a', 'b', 'c', 'd'];
  var sl = ['b', 'c', 'd', 'e'];
  
  var e, a, v;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Push/Pop
pl.push('e');
v = pl[pl.length-1];
e = pl.pop();
ready
Unshift/Shift
sl.unshift('a');
v = sl[0];
a = sl.shift();
ready
Push/Access/Pop

 
ready
Unshift/Access/Shift
ready

Revisions

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