concat vs push_join (v26)

Revision 26 of this benchmark created by Ricardo on


Setup

var c, ret,
  s1 = "Test1",
  s2 = "Test2";

Test runner

Ready to run.

Testing in
TestOps/sec
concat
c = "";
ret = "";

for(var i = 0; i < 10000; i++) {
    c += s1;
    c += s2;
}

ret += c;
return ret;
ready
push_join
c = [];
ret = [];

for(var i = 0; i < 10000; i++) {
    c.push(s1);
    c.push(s2);
}

ret.push(c.join(""));
return ret.join("");
ready

Revisions

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