Script Preparation code:
Tests:
  • With Regexp

  • With Regexp of smaller scope

  • With for-loop

  • With for-loop (initialized length)

  • With lastIndexOf and substring

  • With lastIndexOf and slice

  • With split, slice, join

  • With split, pop, join

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    With Regexp
    With Regexp of smaller scope
    With for-loop
    With for-loop (initialized length)
    With lastIndexOf and substring
    With lastIndexOf and slice
    With split, slice, join
    With split, pop, join

    Fastest: N/A

    Slowest: N/A

Get performance results from real users on your website with Request Metrics.
Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
Chrome 80 on Windows
View result in a separate tab
Test name Executions per second
With Regexp 495440.1 Ops/sec
With Regexp of smaller scope 504375.4 Ops/sec
With for-loop 419858.5 Ops/sec
With for-loop (initialized length) 342976.7 Ops/sec
With lastIndexOf and substring 3019218.0 Ops/sec
With lastIndexOf and slice 3054037.0 Ops/sec
With split, slice, join 254613.0 Ops/sec
With split, pop, join 260353.4 Ops/sec