concat vs + vs join (v15)

Revision 15 of this benchmark created on


Description

How to concat strings faster.

Test runner

Ready to run.

Testing in
TestOps/sec
concat
var str = '';

for (var i = 0; i < 1000; i++) {
    str.concat('test');
}
ready
+
var str = '';

for (var i = 0; i < 1000; i++) {
    str += 'test';
}
 
ready
join
var arr = [];

for (var i = 0; i < 1000; i++) {
    arr.push('test');
}

arr.join();
ready

Revisions

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