Array push() vs unshift() (v29)

Revision 29 of this benchmark created on


Description

Tests the performance difference of using two different ways of filling arrays at the start. The two TCs produce the same result.

Test runner

Ready to run.

Testing in
TestOps/sec
push()
var a = [];
a.push(6);
a.push(5);
a.push(4);
a.push(3);
a.push(2);
a.push(1);
a = a.reverse();
ready
unshift()
var a = [];
a.unshift(6);
a.unshift(5);
a.unshift(4);
a.unshift(3);
a.unshift(2);
a.unshift(1);
ready
concat()
var a = [];
a.concat([6])
a.concat([5]);
a.concat([4]);
a.concat([3]);
a.concat([2]);
a.concat([1]);
ready

Revisions

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