Script Preparation code:
x
 
function generateRandomString(length) {
    var result           = '';
    var characters       = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
    var charactersLength = characters.length;
    for ( var i = 0; i < length; i++ ) {
       result += characters.charAt(Math.floor(Math.random() * charactersLength));
    }
    return result;
}
var arr = " ".repeat(100).split(" ").map(x => generateRandomString(3000));
Tests:
  • Join

     
    arr.join(", ");
  • Array reduce (how is this so fast?)

     
    arr.reduce( (s, el) => s+el )
  • Template literals

     
    `${[...arr]}`
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Join
    Array reduce (how is this so fast?)
    Template literals

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Chrome 122 on Windows
View result in a separate tab
Test name Executions per second
Join 620.5 Ops/sec
Array reduce (how is this so fast?) 2046133.6 Ops/sec
Template literals 608.9 Ops/sec