Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Chrome 123
Windows
Desktop
2 years ago
Test name Executions per second
regex start 349.3 Ops/sec
startsWith 785.6 Ops/sec
regex end 315.9 Ops/sec
endsWith 777.9 Ops/sec
indexOf start 7189.4 Ops/sec
indexOf end 7238.8 Ops/sec
charAt end 619.1 Ops/sec
charCodeAt end 696.2 Ops/sec
charCodeAt start 677.5 Ops/sec
substring 7040.6 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • regex start

  • startsWith

  • regex end

  • endsWith

  • indexOf start

  • indexOf end

  • charAt end

  • charCodeAt end

  • charCodeAt start

  • substring