concat push (v4)

Revision 4 of this benchmark created by Jasper 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

Revisions

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