Array push vs unshift

Benchmark created on


Setup

const apush = [];
const aunshift = [];
const cycleCount = 100;

Test runner

Ready to run.

Testing in
TestOps/sec
Array.push
for (let i=0; i<cycleCount; i++) {
	apush.push(i);
}
ready
Array.unshift
for (let i=0; i<cycleCount; i++) {
	aunshift.unshift(i);
}
ready

Revisions

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