Fastest array combining method (v2)

Revision 2 of this 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
Flat
outputArray = arrayOfArrays.flat();
ready
apply push
arrayOfArrays.forEach((array) => {
	outputArray.push(...array);
});
ready

Revisions

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