Tests:
  • Template string slicing

    x
     
    const id = '10135533-2332-4012-aada-b36571a05399';
    `${id.slice(1, 8)}${id.slice(9, 13)}${id.slice(15, 18)}`
  • Array push and join

     
    const id = '10135533-2332-4012-aada-b36571a05399';
    const timeStampParts = []
      const chars = id.split('')
      let index = 0
      for (const char of chars) {
        if (
          (index !== 0 && index < 8) ||
          (index >= 9 && index < 13) ||
          (index >= 15 && index < 18)
        ) {
          timeStampParts.push(char)
        }
        index += 1
      }
    const timestamp = timeStampParts.join('')
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Template string slicing
    Array push and join

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one month ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Chrome 134 on Linux
View result in a separate tab
Test name Executions per second
Template string slicing 49319032.0 Ops/sec
Array push and join 3402783.5 Ops/sec