join/concat

JavaScript performance comparison

Revision 54 of this test case created by safety

Preparation code

<script>
  var str = 'string';
  var barr = ['this', ' is', ' a', str, ' to', ' test', ' if', ' there', ' is', ' any', ' difference', ' between', ' concat', ' and', ' join'];
  var sarr = ['this', ' is', ' a', str];
</script>
    

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
concat
var a = 'this' + ' is' + ' a' + str + ' to' + ' test' + ' if' + ' there' + ' is' + ' any' + ' difference' + ' between' + ' concat' + ' and' + ' join';
pending…
join
var a = barr.join('');
pending…
concat shorter
var a = 'this' + ' is' + ' a' + str;
pending…
join shorter
var a = sarr.join('');
pending…
concat in a loop
var str = '';
for (var i = 0; i < barr.length; i++) {
  str += barr[i];
}
pending…
concat reduce
var str = barr.reduce(function(p,c,i,a) { return p+c; });
pending…

Compare results of other browsers

Revisions

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

0 Comments