Concatenation vs Array Join (v16)

Revision 16 of this benchmark created by Andrew Barrett on


Preparation HTML

<script>
  var i, j;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Concatenation
var str = '';
for (i = 0; i < 10000; i++) {
 str += 'a';
}
ready
Array.prototype.join
var tmp = [], str2 = '';
for (j = 0; j < 10000; j++) {
 tmp.push('a');
}
str2 = tmp.join('');
ready

Revisions

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