string concat vs array join (v31)

Revision 31 of this benchmark created on


Setup

var bin = [];
  var text = '';
  var temp = [];
  
  for (var i = 0; i < 10000; i++) {
    bin[i] = i % 256;
  }

Test runner

Ready to run.

Testing in
TestOps/sec
Concat
for(i = 0; i < 10000; ++i)
{
    text += String.fromCharCode(bin[i]);
}

ready
Join
for(i = 0; i < 10000; ++i)
{
    temp[i] = String.fromCharCode(bin[i]);
}

text = temp.join('');
ready
Push
for(i = 0; i < 10000; ++i)
{
    temp.push(String.fromCharCode(bin[i]));
}

text = temp.join('');
ready

Revisions

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