Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Safari/605.1.15
Safari 14
Mac OS X 10.15.7
Desktop
3 years ago
Test name Executions per second
short endsWith 9822598.0 Ops/sec
short regexp 4342257.5 Ops/sec
short charAt 5838919.0 Ops/sec
short brackets 6079588.5 Ops/sec
short CharCodeAt 6327453.5 Ops/sec
short slice 11022681.0 Ops/sec
short substr 10172826.0 Ops/sec
short substring 5786320.5 Ops/sec
long endsWidth 10345365.0 Ops/sec
long regexp 23.1 Ops/sec
long charAt 6225146.0 Ops/sec
long brackets 6347367.0 Ops/sec
long charCodeAt 6227064.0 Ops/sec
long slice 11012061.0 Ops/sec
long substr 9657854.0 Ops/sec
long substring 5703595.5 Ops/sec
Script Preparation code:
Tests:
  • short endsWith

  • short regexp

  • short charAt

  • short brackets

  • short CharCodeAt

  • short slice

  • short substr

  • short substring

  • long endsWidth

  • long regexp

  • long charAt

  • long brackets

  • long charCodeAt

  • long slice

  • long substr

  • long substring