Concat VS Spread

Benchmark created by agronick on


Setup

const a = [];
  const b = [];
  
  const limit = 10000;
  
  for (let i=0; i<limit; i++) {
     a.push(i)
     b.push(limit-i);
  }

Test runner

Ready to run.

Testing in
TestOps/sec
Concat
let c = a.concat(b);
ready
Spread
let c = [...a, ...b];
ready
Push
a.push(...b)
ready

Revisions

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

  • Revision 1: published by agronick on