Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36
Chrome 84
Windows
Desktop
4 years ago
Test name Executions per second
Match RegEx via Lookahead and Capture Group 1438170.5 Ops/sec
Replace Unwanted Parts with Replace RegEx 85889.5 Ops/sec
String Split and Reference Array Index with length -1 (const intermediate) 2454328.8 Ops/sec
String Split and Reference Array Index with length -1 (var intermediate) 2382033.8 Ops/sec
String Split and Reference Array Index with length -1 (no intermediate var) 2645701.5 Ops/sec
String Split with pop 2665025.0 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