concat/join-with-push/join-without-push (v168)

Revision 168 of this benchmark created by Gandalf S. on


Setup

function makeid() {
    var text = "";
    var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  
    for (var i = 0; i < 5; i++)
      text += possible.charAt(Math.floor(Math.random() * possible.length));
  
    return text;
  }
  
  
  var data = [];
  
  for (var i = 0; i < 10000; i++) {
    data.push(makeid());
  }

Test runner

Ready to run.

Testing in
TestOps/sec
es6 Template
for (var res = '', i = 0; i < data.length; i++) {
  res = `${res}${data[i]}`;
}
ready
concat function
for (var res = '', i = 0; i < data.length; i++) {
  res.concat(data[i]);
}
ready

Revisions

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