StringMerge plusoperator VS arrayJoin

JavaScript performance comparison

Test case created by jkyang

Preparation code

<html>
<body>
<div id="container" style="border: 2px solid red;">
</div>
</body>
<script>
  var oContainer = document.getElementById("container");
</script>
    

Preparation code output

<html> <body> <div id="container" style="border: 2px solid red;"> </div> </body>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
plus operator
var sStr = "A";
sStr += "B";
sStr += "C";
sStr += "D";
sStr += "E";
sStr += "F";
sStr += "G";
sStr += "H";
sStr += "I";
sStr += "J";
sStr += "K";
sStr += "L";
sStr += "M";
sStr += "N";
sStr += "O";
sStr += "P";
sStr += "Q";
sStr += "R";
sStr += "S";
sStr += "T";
sStr += "U";
sStr += "V";
sStr += "W";
sStr += "X";
sStr += "Y";
sStr += "Z";
oContainer.innerHTML = sStr;
pending…
array join
var arrData = [];
arrData.push("A");
arrData.push("B");
arrData.push("C");
arrData.push("D");
arrData.push("E");
arrData.push("F");
arrData.push("G");
arrData.push("H");
arrData.push("I");
arrData.push("J");
arrData.push("K");
arrData.push("L");
arrData.push("M");
arrData.push("N");
arrData.push("O");
arrData.push("P");
arrData.push("Q");
arrData.push("R");
arrData.push("S");
arrData.push("T");
arrData.push("U");
arrData.push("V");
arrData.push("W");
arrData.push("X");
arrData.push("Y");
arrData.push("Z");

var sStr = arrData.join("");
oContainer.innerHTML = sStr;
pending…

Compare results of other browsers

Revisions

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

0 Comments