Append One Array To Another

Benchmark created on


Setup

const a = [...Array(10000).keys()]
const b = [...Array(10000).keys()]

Test runner

Ready to run.

Testing in
TestOps/sec
Push + Of
for (let n of b) {
 a.push(n) 
}
ready
Push + Index
for (let i = 0; i < b.length; i++) {
 a.push(b[0]) 
}
ready
Concat
a.concat(b)
ready
Apply
a.push.apply(a,b)
ready
Spread
[...a, ...b]
ready
Push + Spread
a.push(...b)
ready

Revisions

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