slice vs splice vs pop (v3)

Revision 3 of this benchmark created on


Setup

var numberTest = [0, 1, 2, 3, 4, 5, 6, 7],
      stringTest = ['one', 'two', 'three', 'four', 'five', 'six', 'seven'],
      longTest = new Array(100000);

Test runner

Ready to run.

Testing in
TestOps/sec
Short Number Slice
numberTest = numberTest.slice(0, -1);
ready
Short String Slice
stringTest = stringTest.slice(0, -1);
ready
Long Slice
longTest = longTest.slice(0, -1);
ready
Short Number splice
numberTest.splice(-1, 1);
ready
Short String splice
stringTest.splice(-1, 1);
ready
Long Splice
longTest.splice(-1, 1);
ready
Short Number Pop
numberTest.pop();
ready
Short String Pop
stringTest.pop();
ready
Long Pop
longTest.pop();
ready

Revisions

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