Array push() vs unshift() to existing (v15)

Revision 15 of this benchmark created on


Description

Tests the performance of reverse, push, reverse and unshift for adding an element to the start of an existing array.

Setup

var arr = [0, 1, 2, 3];

Teardown


    var arr = [0, 1, 2, 3];
  

Test runner

Ready to run.

Testing in
TestOps/sec
push()
arr.reverse();
arr.push(4);
arr.reverse();
ready
unshift()
arr.unshift(4);
ready

Revisions

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