Pop vs Splice (v7)

Revision 7 of this benchmark created on


Setup

var x = [];
    for (var i = 0; i < 100; ++i) {
      x.push(i);
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Pop
while (i = x.pop()) {
  //do something
}
ready
Splice
for (var length = x.length; length >= 0; length--) {
  i = x.splice(length, 1);
}
ready

Revisions

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