Tests:
  • String()

    AخA
     
    let nums = [];
    for(let i = 0; i < 100; ++i) {
      nums.push(String(i));
    }
  • .toString()

     
    let nums = [];
    for(let i = 0; i < 100; ++i) {
      nums.push(i.toString());
    }
  • template string

     
    let nums = [];
    for(let i = 0; i < 100; ++i) {
      nums.push(`${i}`);
    }
  • concat with string

     
    let nums = [];
    for(let i = 0; i < 100; ++i) {
      nums.push(i + "");
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    String()
    .toString()
    template string
    concat with string

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (X11; CrOS x86_64 14092.77.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.107 Safari/537.36
Chrome 93 on Chrome OS 14092.77.0
View result in a separate tab
Test name Executions per second
String() 15198.2 Ops/sec
.toString() 175576.0 Ops/sec
template string 270942.2 Ops/sec
concat with string 272331.6 Ops/sec