join/concat (v65)

Revision 65 of this benchmark created on


Description

A simpler check for testing for concat vs join outside of a loop (not building a string in a loop, typical use case would be to use a var in the string).

Test runner

Ready to run.

Testing in
TestOps/sec
concat
var str = 'string';
var a = 'this' + ' is' + ' a' + str + ' to' + ' test' + ' if' + ' there' + ' is' + ' any' + ' difference' + ' between' + ' concat' + ' and' + ' join';
ready
join
var str = 'string';
var barr = ['this', ' is', ' a', str, ' to', ' test', ' if', ' there', ' is', ' any', ' difference', ' between', ' concat', ' and', ' join'];
var a = barr.join('');
ready
concat shorter
var str = 'string';
var a = 'this' + ' is' + ' a' + str;
ready
join shorter
var str = 'string';
var sarr = ['this', ' is', ' a', str];
var a = sarr.join('');
ready
concat in a loop
var str = '';
var barr = ['this', ' is', ' a', str, ' to', ' test', ' if', ' there', ' is', ' any', ' difference', ' between', ' concat', ' and', ' join'];
for (var i = 0; i < barr.length; i++) {
  str += barr[i];
}
ready

Revisions

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