Concat vs Splice (v9)

Revision 9 of this benchmark created on


Description

Compare repeated concat to splice

Setup

a = [];
    b = [];
    
    for(var i = 0; i < 1000; i++) {
      a.push(i);
      b.push(i);
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Concat
var s = b.slice(0);
var c = a.concat(s);
ready
Splice
var s = b.slice(0);
s.unshift(0, 0);
a.splice.apply(a, s);
ready

Revisions

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