String concat versus array join (v2)

Revision 2 of this benchmark created by ryanatk on


Preparation HTML

<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

Revisions

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