Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_16_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36
Chrome 84
Mac OS X 10.16.0
Desktop
4 years ago
Test name Executions per second
character index 3507037.5 Ops/sec
charAt() 3396388.8 Ops/sec
startsWith() 3402368.8 Ops/sec
slice() 2985060.8 Ops/sec
RegExp 2369607.8 Ops/sec
Script Preparation code:
Tests:
  • character index

  • charAt()

  • startsWith()

  • slice()

  • RegExp