Script Preparation code:
x
 
var nLoops = 1000;
var shortString = String(Math.random());
var longString = '';
for (var i = 0; i < 40; i++) {
  longString += String(Math.random());
}
Tests:
  • Add short string each loop

     
    var str = '';
    for (var i = 0; i < nLoops; i++) {
      str += shortString;
    }
  • Add long string each loop

     
    var str = '';
    for (var i = 0; i < nLoops; i++) {
      str += longString;
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Add short string each loop
    Add long string each loop

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/109.0
Firefox 109 on Mac OS X 10.15
View result in a separate tab
Test name Executions per second
Add short string each loop 363201.4 Ops/sec
Add long string each loop 361800.6 Ops/sec