string concat vs array join (v19)

Revision 19 of this benchmark created on


Setup

var JSONMember = ["<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>", "<div>"];
  var final = "";

Test runner

Ready to run.

Testing in
TestOps/sec
Concat
JSONMember.forEach(function(str) {
  final += str;
});
ready
Join
final = JSONMember.join();
ready
String.concat
final = String.prototype.concat.apply('', JSONMember)
ready
for loop
for (var i = -1, c = JSONMember.length; ++i < c;) {
  final += JSONMember[i];
}
ready
for loop
for (var i = -1, c = JSONMember.length; ++i < c;) {
  final += JSONMember[i];
}
ready

Revisions

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