string concat vs array join (v35)

Revision 35 of this benchmark created by Helder Magalhães on


Setup

var arrayOfArrays = [ [123, "XY"], [345, "z"], [456, "K"] ];
  var dummy; //just to force attribution

Teardown



            arrayOfArrays = dummy = null;
        
  

Test runner

Ready to run.

Testing in
TestOps/sec
Concat
for(i = 0, j = arrayOfArrays.length; i < j; ++i) {
  dummy = arrayOfArrays[i][0] + " " + arrayOfArrays[i][1];
}
ready
Concat (by parts)
for(i = 0, j = arrayOfArrays.length; i < j; ++i) {
  dummy = arrayOfArrays[i][0];
  dummy += " ";
  dummy +=arrayOfArrays[i][1];
}
ready
Join
for(i = 0, j = arrayOfArrays.length; i < j; ++i) {
  dummy = arrayOfArrays[i].join(" ");
}
ready

Revisions

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