concat vs array

Benchmark created on


Description

Testing the building of a string

Setup

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

Test runner

Ready to run.

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

Revisions

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