Spread vs. concat

Benchmark created on


Setup

const a = new Array(1000).fill(0);
const b = new Array(1000).fill(1);

Test runner

Ready to run.

Testing in
TestOps/sec
Spread
const x = [...a, ...b];
let k = x[3];
ready
Concat
const x = a.concat(b);
let k = x[3];
ready

Revisions

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