Adding items to smi array

Benchmark created on


Setup

let one = [...Array(1000).keys()]
let two = [...Array(500).keys()]

Test runner

Ready to run.

Testing in
TestOps/sec
push (spread)
one.push(...two)
ready
push (apply)
Array.prototype.push.apply(one, two)
ready
push (for)
for (let i = 0; i < two.length; i++) one.push(two[i])
ready
push (for...of)
for (const i of two) one.push(i)
ready
copy (concat)
one = one.concat(two)
ready
copy (spread)
one = [...one, ...two]
ready

Revisions

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