HTML Preparation code:
Script Preparation code:
Tests:

Historical Performance Data aggregated from 8 community runs

Desktop Results:
Chrome 8 runs
substring
150.9M/s
charCodeAt
147.8M/s
[]
146.9M/s
charAt
139.7M/s
slice
124.5M/s

Fastest: substring (1.2x faster)

View exact numbers
  • substring: 150,881,088 ops/sec
  • charCodeAt: 147,799,072 ops/sec
  • []: 146,852,864 ops/sec
  • charAt: 139,736,896 ops/sec
  • slice: 124,536,176 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    slice
    substring
    []
    charAt
    charCodeAt

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Edg/146.0.0.0
Chrome 146 on Windows
View result in a separate tab
charAt
137.2M/s
charCodeAt
127.1M/s
slice
120.9M/s
substring
115.2M/s
[]
112.2M/s
View exact numbers
Test name Executions per second
charAt 137,195,088 Ops/sec
charCodeAt 127,126,464 Ops/sec
slice 120,907,600 Ops/sec
substring 115,170,336 Ops/sec
[] 112,234,440 Ops/sec