push/pop vs unshift/shift (v10)

Revision 10 of this benchmark created on


Preparation HTML

<script>
  var pl = [1, 2, 3, 4];
  var sl = ['b', 'c', 'd', 'e'];
  var del = {}; 

  
  var e, a, v, d;
</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
v = pl.pop();
v++;
pl.push(v);
ready
Unshift/Access/Shift
sl.unshift('a');
v = sl[0];
a = sl.shift();
ready
delete
del.a = {b: 0};
del.a++;
delete del.a;
ready

Revisions

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