Testing in reduce

Benchmark created on


Setup

const arr = new Array(200).fill([
  ['a', 'b', 'c', 'd'],
  ['e', 'f', 'g', 'h']
 ]);

Test runner

Ready to run.

Testing in
TestOps/sec
Concat
const result = arr.reduce((accum, elem) => {
	return accum.concat(elem[0], elem[1]);
}, []);
ready
Push
const result = arr.reduce((accum, elem) => {
	accum.push(...elem[0]);
	accum.push(...elem[1]);
	return accum;
}, []);
ready

Revisions

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