String concat versus array join (v3)

Revision 3 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
  var boo = 'gas',
      cool = 'beans',
      foo = 'bar';
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
String concat
var s = "div" + boo + "div" + cool + "string" + foo + "div" + "div" + boo + "div" + cool + "string" + foo + "div" + "div" + boo + "div" + cool + "string" + foo + "div" + "div" + boo + "div" + cool + "string" + foo + "div";
ready
Array join
var s = ["div", boo, "div", cool, "string", foo, "div", "div", boo, "div", cool, "string", foo, "div", "div", boo, "div", cool, "string", foo, "div", "div", boo, "div", cool, "string", foo, "div"].join("");
ready
String only concat
var s = "div" + "div" + "string" +  "div" + "div" +  "div" +  "string" +  "div" + "div" +  "div" +  "string" +  "div" + "div" +  "div" +  "string" +  "div";
ready
String only array join
var s = ["div", "div", "string", "div", "div", "div", "string", "div", "div", "div", "string", "div", "div", "div", "string", "div"].join("");
ready

Revisions

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