string concat vs array join

JavaScript performance comparison

Revision 73 of this test case created by L3P3

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var array='aoisd142gjklgalks336djbglaiuebl36igu36abligu7l8aaoisd142gjklgalks336djbglaiueblf36igu36abligu7l8a'.split('');
  
  var substr=String.prototype.substr;

};
</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 string='';
for(var i=0,l=array.length;i<l;i++)string+=array[i];
pending…
join('')
var string=array.join('');
pending…
join
var string=array.join();
pending…
substr.call
var string=substr.call(array,0);
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