Reduce: recreate array vs reuse (v2)

Revision 2 of this benchmark created on


Setup

const N = 2000;

Test runner

Ready to run.

Testing in
TestOps/sec
recreate
Array.from(Array(N)).reduce((array, _, i) => {
	return [...array, i];
}, []);
ready
reuse
Array.from(Array(N)).reduce((array, _, i) => {
	array.push(i);
	return array;
}, []);
ready

Revisions

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