Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15
Safari 13
Mac OS X 10.14.6
Desktop
3 years ago
Test name Executions per second
substring and substring 2598255.0 Ops/sec
replace inline regex 3170921.0 Ops/sec
replace compiled regex var 2480492.0 Ops/sec
brackets and substring 2796642.0 Ops/sec
brackets and slice 2908649.0 Ops/sec
substring and slice 2728311.0 Ops/sec
brackets and substr (legacy) 2803882.0 Ops/sec
substr and substr (legacy) 2678515.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)