Run details:
Mozilla/5.0 (Linux; Android 12; M2101K7BNY) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Mobile Safari/537.36
Chrome Mobile 107
Android
Mobile
2 years ago
Test name Executions per second
Regex and Loop 150423.0 Ops/sec
For loop, ParseInt 279909.9 Ops/sec
For loop with switch case 283188.2 Ops/sec
For loop, toString 466281.7 Ops/sec
Pure Regex 1783433.0 Ops/sec
Script Preparation code:
Tests:
  • Regex and Loop

  • For loop, ParseInt

  • For loop with switch case

  • For loop, toString

  • Pure Regex