Concat vs Splice

Benchmark created on


Description

Compare repeated concat to splice

Test runner

Ready to run.

Testing in
TestOps/sec
Concat
var a = [];
for(var i = 0; i < 1000; i++) {
  a = a.concat([i]);
}
ready
Splice
var a = [];
for(var i = 0; i < 1000; i++) {
   Array.prototype.splice.apply(a, [i, 0].concat([i]));
}
ready

Revisions

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