concat vs + vs join

JavaScript performance comparison

Test case created by Nicolas Froidure

Info

How to concat strings faster.

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
concat
'Coucou '.concat('c\'est ', 'nous !');
pending…
+
'Coucou ' + 'c\'est ' + 'nous !';
pending…
join
['Coucou ', 'c\'est ', 'nous !'].join();
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. Here’s a list of current revisions for this page:

1 comment

spamus commented :

This test is not a fair test as the strings in the plus operator example can be statically concatenated in advance without having to call any methods during runtime. Strings should be randomly generated to prevent this from being an issue.

Comment form temporarily disabled.

Add a comment