push/pop vs unshift/shift (v41)

Revision 41 of this benchmark created on


Preparation HTML

<script>
  var pl = ['1', '2', '3', '4'];
  var sl = ['1', '2', '3', '4'];
  
  var e, a, v;
</script>

Test runner

Ready to run.

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

Revisions

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