Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0
Firefox 138
Windows
Desktop
one year ago
spread concat -- output = [].concat(...batches)
10K/s
push spread -- output.push(...batch)
7K/s
push loop -- for (const v of batch) { output.push(v) }
6K/s
repeated concat -- output = output.concat(batch)
68/s
repeated spread -- output = [...output, ...batch]
14/s
View exact numbers
Test name Executions per second
spread concat -- output = [].concat(...batches) 9,530 Ops/sec
push spread -- output.push(...batch) 7,374 Ops/sec
push loop -- for (const v of batch) { output.push(v) } 5,661 Ops/sec
repeated concat -- output = output.concat(batch) 68 Ops/sec
repeated spread -- output = [...output, ...batch] 14 Ops/sec
Script Preparation code:
Tests: