Concat VS Spread

JavaScript performance comparison

Test case created by agronick

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  const a = [];
  const b = [];
  
  const limit = 10000;
  
  for (let i=0; i<limit; i++) {
     a.push(i)
     b.push(limit-i);
  }

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Concat
let c = a.concat(b);
pending…
Spread
let c = [...a, ...b];
pending…
Push
a.push(...b)
pending…

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

Compare results of other browsers

0 Comments