array combinations

Benchmark created on


Setup

const arrayList = [];


for (let i = 0; i < 50; i++) {
	arrayList.push(Array.from({length: 2000}, () => Math.floor(Math.random() * 40)))
}

Test runner

Ready to run.

Testing in
TestOps/sec
destructured push
const fuz = [];
for (let i of arrayList) {
	fuz.push(...arrayList);
}
ready
apply concat
const foo = [].concat.apply([], arrayList)
ready
destructured push into object
const fuz = {'interesting':[]};
for (let i of arrayList) {
	fuz.interesting.push(...arrayList);
}
ready
flat
const foo = arrayList.flat();
ready

Revisions

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