Array spread vs push

Benchmark created on


Setup

const numbers = Array.from(Array(1000).keys()).map(i => [i])

Test runner

Ready to run.

Testing in
TestOps/sec
Array spread
numbers.reduce((acc, cur) => {
	acc = [...acc, ...cur]
	
	return acc
}, [])
ready
Array.push
numbers.reduce((acc, cur) => {
	acc.push(...cur)
	
	return acc
}, [])
ready

Revisions

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