Push vs concat

Benchmark created on


Setup

const innerArray = new Array(100).fill({ yay: 'boo' });
const arrayOfArrays = new Array(100).fill(innerArray);

let outputArray = [];

Test runner

Ready to run.

Testing in
TestOps/sec
Push
arrayOfArrays.forEach((array) => {
	array.forEach((item) => {
		outputArray.push(item);
	});
});
ready
Concat
arrayOfArrays.forEach((array) => {
	outputArray = outputArray.concat(array);
});
ready

Revisions

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