concat vs + vs join (v5)

Revision 5 of this benchmark created on


Description

How to concat strings faster.

Setup

var s1='Coucou ', s2='c\'est ', s3='nous !';

Test runner

Ready to run.

Testing in
TestOps/sec
concat
s1.concat(s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3);
ready
+
s1 + s2 + s3 + s1 + s2 + s3 + s1 + s2 + s3 + s1 + s2 + s3 + s1 + s2 + s3 + s1 + s2 + s3 + s1 + s2 + s3 + s1 + s2 + s3 + s1 + s2 + s3 + s1 + s2 + s3 + s1 + s2 + s3 + s1 + s2 + s3;
ready
join
[s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3, s1, s2, s3].join();
ready

Revisions

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