Script Preparation code:
Tests:

Historical Performance Data aggregated from 88 community runs

Desktop Results:
Chrome 67 runs
slice()
13.1M/s
charAt()
12.9M/s
character index
12.9M/s
View exact numbers
  • slice(): 13,098,044 ops/sec
  • charAt(): 12,936,922 ops/sec
  • character index: 12,881,538 ops/sec
Firefox 21 runs
character index
174.5M/s
charAt()
137.7M/s
slice()
137.7M/s

Fastest: character index (1.3x faster)

View exact numbers
  • character index: 174,500,560 ops/sec
  • charAt(): 137,715,328 ops/sec
  • slice(): 137,667,248 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
    character index
    charAt()
    slice()

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one month ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36
Chrome 149 on Mac OS X 10.15.7
View result in a separate tab
character index
158.9M/s
charAt()
157.7M/s
slice()
151.1M/s
View exact numbers
Test name Executions per second
character index 158,857,488 Ops/sec
charAt() 157,744,336 Ops/sec
slice() 151,087,664 Ops/sec