2 spreads vs concat

Benchmark created on


Setup

const columnDefinitions = {}
const sortedNewColumns = []

const size = 10000;

for (let i = 0; i < size; i++) {
	columnDefinitions[`attribute-${i}`] = { field: i };
	sortedNewColumns.push({ field: i + size });
}

Test runner

Ready to run.

Testing in
TestOps/sec
2 spreads
const arr = [...Object.values(columnDefinitions), ...sortedNewColumns]
ready
concat
const arr = Object.values(columnDefinitions).concat(sortedNewColumns)
ready

Revisions

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