push/pop vs unshift/shift (v12)

Revision 12 of this benchmark created 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');
e = pl.pop();
ready
Unshift/Shift
sl.unshift('a');
a = sl.shift();
ready
Push/Access/Pop
pl.push('e');
v = pl[pl.length];
e = pl.pop();
ready
Unshift/Access/Shift
sl.unshift('a');
v = sl[0];
a = sl.shift();
ready
sl.push('a');
sl.shift();
ready

Revisions

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