concat push (v5)

Revision 5 of this benchmark created on


Setup

var a = ['the quick brown fox', 'jumps over the lazy dog'];
    var b = ['and the lazy dog', 'does not mind'];
    var push = Array.prototype.push;

Test runner

Ready to run.

Testing in
TestOps/sec
concat
a = a.concat(b);
ready
push each
a.push(b[0]);
a.push(b[1]);
ready
push all
a.push(b[0], b[1]);
ready
push-apply
push.apply(a, b);
 
ready
Copy, then concat (new instance)
var c = a.slice(0);
push.apply(c, b);
ready
native
var c;

c += a.toString();
c += b.toString();
ready

Revisions

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