Concat string vs join

JavaScript performance comparison

Test case created by ryun

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
string concat
var template = '<div class="widgets">'+
'<a href="#" class="widget" class="button radius">Widget1</a>'+
'<a href="#" class="widget" class="button radius">Widget2</a>'+
'<a href="#" class="widget" class="button radius">Widget3</a>'+
'<a href="#" class="widget" class="button radius">Widget4</a>'+
'<a href="#" class="widget" class="button radius">Widget5</a>'+
'<a href="#" class="widget" class="button radius">Widget6</a>'+
'<a href="#" class="widget" class="button radius">Widget7</a>'+
'<a href="#" class="widget" class="button radius">Widget8</a>'+
'<a href="#" class="widget" class="button radius">Widget9</a>'+
'<a href="#" class="widget" class="button radius">Widget10</a>'+
'</div>';
pending…
join concat
var template = [
'<div class="widgets">',
'<a href="#" class="widget" class="button radius">Widget1</a>',
'<a href="#" class="widget" class="button radius">Widget2</a>',
'<a href="#" class="widget" class="button radius">Widget3</a>',
'<a href="#" class="widget" class="button radius">Widget4</a>',
'<a href="#" class="widget" class="button radius">Widget5</a>',
'<a href="#" class="widget" class="button radius">Widget6</a>',
'<a href="#" class="widget" class="button radius">Widget7</a>',
'<a href="#" class="widget" class="button radius">Widget8</a>',
'<a href="#" class="widget" class="button radius">Widget9</a>',
'<a href="#" class="widget" class="button radius">Widget10</a>',
'</div>'
].join("");
pending…

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

Compare results of other browsers

0 comments

Add a comment