Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1
Mobile Safari 14
iOS 14.0
Mobile
4 years ago
Test name Executions per second
Match RegEx via Lookahead and Capture Group 561624.2 Ops/sec
Replace Unwanted Parts with Replace RegEx 31510.6 Ops/sec
String Split and Reference Array Index with length -1 (const intermediate) 869749.2 Ops/sec
String Split and Reference Array Index with length -1 (var intermediate) 772324.4 Ops/sec
String Split and Reference Array Index with length -1 (no intermediate var) 1430471.2 Ops/sec
String Split with pop 1578588.2 Ops/sec
Script Preparation code:
Tests:
  • Match RegEx via Lookahead and Capture Group

  • Replace Unwanted Parts with Replace RegEx

  • String Split and Reference Array Index with length -1 (const intermediate)

  • String Split and Reference Array Index with length -1 (var intermediate)

  • String Split and Reference Array Index with length -1 (no intermediate var)

  • String Split with pop