Splicing a single value (v26)

Revision 26 of this benchmark created on


Setup

var arr = [];
    for (var i = 0; i < 100000; i++)
      arr.push(i);
    var half = arr.length>>1;

Test runner

Ready to run.

Testing in
TestOps/sec
Splice insertion at half-way point
arr.splice(half, 0, 42);
arr.pop();
ready
Push
arr.push(42);
arr.pop();
ready
Unshift
arr.unshift(42);
arr.pop();
ready
Splice at beginning of array
arr.splice(0, 0, 42);
arr.pop();
ready
Unshift and Shift
arr.unshift(42);
arr.shift();
ready
Splice at beginning of array and Shift
arr.splice(0, 0, 42);
arr.shift();
ready

Revisions

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