concat vs + vs join (v45)

Revision 45 of this benchmark created by Myron Yao on


Setup

var i = Math.floor(Math.random() * 10);
  
  var a = '' + i++;
  var b = '' + i++;
  var c = '' + i++;
  var d = '' + i;

Test runner

Ready to run.

Testing in
TestOps/sec
concat
a.concat(', ', b, ', ', c, ', ', d);
ready
+
a + ', ' + b + ', ' + c + ', ' + d;
ready
join
[a, b, c, d].join(', ');
ready

Revisions

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