string concat vs array join (v12)

Revision 12 of this benchmark created by Terry Anastasiadis on


Preparation HTML

<script>
  var arr = ['1st', '2nd', '3rd', '4th'];
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Concat
var text = '',
    i = 0,
    l = arr.length;

for (; i < l; i += 1) {
  text += 'I told you the ' + arr[i] + ' time.<br>';
}
ready
Join
var text = 'I told you the ' + arr.join(' time.<br>I told you the ') + ' time.';
ready

Revisions

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