Run details:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:57.0) Gecko/20100101 Firefox/57.0
Firefox 57
Windows 7
Desktop
3 years ago
Test name Executions per second
substring and substring 13533440.0 Ops/sec
replace inline regex 9592837.0 Ops/sec
replace compiled regex var 9599001.0 Ops/sec
brackets and substring 22613330.0 Ops/sec
brackets and slice 31001520.0 Ops/sec
substring and slice 15546900.0 Ops/sec
brackets and substr (legacy) 33632500.0 Ops/sec
substr and substr (legacy) 11924260.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)