Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
Chrome 73
Windows 7
Desktop
3 years ago
Test name Executions per second
substring and substring 2163813.0 Ops/sec
replace inline regex 2680835.0 Ops/sec
replace compiled regex var 2197374.0 Ops/sec
brackets and substring 2329782.0 Ops/sec
brackets and slice 2364876.0 Ops/sec
substring and slice 2401939.0 Ops/sec
brackets and substr (legacy) 2411613.0 Ops/sec
substr and substr (legacy) 2315858.0 Ops/sec
Script Preparation code:
Tests:
  • substring and substring

  • replace inline regex

  • replace compiled regex var

  • brackets and substring

  • brackets and slice

  • substring and slice

  • brackets and substr (legacy)

  • substr and substr (legacy)