join/concat (v22)

Revision 22 of this benchmark created by JasonC 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).

Preparation HTML

<script>
  var str = 'string';
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
concat
var a = 'this' + ' is' + ' a' + str + ' to' + ' test' + ' if' + ' there' + ' is' + ' any' + ' difference' + ' between' + ' concat' + ' and' + ' join';
ready
join
var a = ['this', ' is', ' a', str, ' to', ' test', ' if', ' there', ' is', ' any', ' difference', ' between', ' concat', ' and', ' join'].join('');
ready
concat shorter
var a = 'this' + ' is' + ' a' + str;
ready
join shorter
var a = ['this', ' is', ' a', str].join('');
ready

Revisions

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