concat vs + vs join (v51)

Revision 51 of this benchmark created on


Description

How to concat strings faster.

Test runner

Ready to run.

Testing in
TestOps/sec
concat
'Coucou '.concat('c\'est ');
ready
+
'Coucou ' + 'c\'est ';
ready
tl
var arguments = ['Coucou ', 'c\'est '];
var strTmp = '{0} {1}',
        i = arguments.length;

    while (i--) {
        strTmp = strTmp.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]);
    }
ready
adder
function add(a, b) { return a + b; }

add('Coucou ', 'c\'est ');
ready

Revisions

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