String vs Array concat

JavaScript performance comparison

Revision 9 of this test case created by

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
String Concat
var dest = 'apple';
while (dest.length < 100) {
 var offs = dest.length - 5;
 for (var i = offs; i < offs + 10; ++i)
 dest += dest[i];
}
pending…
Array Concat
var dest = ['a', 'p', 'p', 'l', 'e'];
while (dest.length < 100) {
 var offs = dest.length - 5;
 for (var i = offs; i < offs + 10; ++i)
 dest.push(dest[i]);
}
dest = dest.join();
pending…
String Concat #2
var dest = 'apple';
while (dest.length < 100) {
 var offs = dest.length - 5;
 for (var i = offs; i < offs + 10; ++i)
 dest = dest.concat(dest[i]);
}
pending…

Compare results of other browsers

Revisions

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

0 Comments