Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 16_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) GSA/255.0.515161012 Mobile/15E148 Safari/604.1
Mobile Safari 16
iOS 16.3
Mobile
one year ago
Test name Executions per second
using plus operator 185539.4 Ops/sec
using concat function 144953.8 Ops/sec
using template literals 84228.7 Ops/sec
Script Preparation code:
AخA
 
var name = "name";
var id = "id";
Tests:
  • using plus operator

     
    for (let i = 0; i < 80; ++i) {
      let result = id + ": 1, " + name + ": someItem";
    }
  • using concat function

     
    for (let i = 0; i < 80; ++i) {
      let result = "".concat(id, ": 1, ", name, ": someItem");
    }
  • using template literals

     
    for (let i = 0; i < 80; ++i) {
      let result = `${id}: 1, ${name}: someItem`;
    }