Spread vs. concat (length: 10)

Benchmark created on


Setup

const size = 100
const array1 = new Array(size)
const array2 = new Array(size)

for (let i = 0; i < size; i++) {
	array1[i] = i
	array2[i] = i
}

Test runner

Ready to run.

Testing in
TestOps/sec
Spread
const result = [...array1, ...array2];
ready
Concat
const result = array1.concat(array2);
ready

Revisions

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