concat vs array (v5)

Revision 5 of this benchmark created on


Description

Testing the building of a string

Setup

var sample = " string",
    str = "",
    arr = [],
    a = 5000,
    b = 0,
    arrjoin;

Test runner

Ready to run.

Testing in
TestOps/sec
array with join
for (; b < a; b += 1) {
arr.push(sample);
}
arrjoin = arr.join("");
ready
string concat
for (; b < a; b += 1) {
str += sample;
}
ready
array join no-push
for (; b < a; b += 1) {
arr[arr.length] = sample;
}
arrjoin = arr.join("");
ready

Revisions

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