Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0
Firefox 72
Linux
Desktop
4 years ago
Test name Executions per second
+= 448047.9 Ops/sec
array joining 319155.3 Ops/sec
template strings 455964.1 Ops/sec
Tests:
  • +=

    AخA
     
    var str = ''
    var chars = 'abcdefghijklmnoprstuwxyz'
    while (str.length < 100) str += chars[ Math.floor( Math.random() * chars.length ) ]
  • array joining

     
    var strarr = []
    var chars = 'abcdefghijklmnoprstuwxyz'
    while (strarr.length < 100) strarr.push(chars[ Math.floor( Math.random() * chars.length ) ])
    var str = strarr.join('')
  • template strings

     
    var str = ''
    var chars = 'abcdefghijklmnoprstuwxyz'
    while (str.length < 100) str = `${str}${chars[ Math.floor( Math.random() * chars.length ) ]}`