Script Preparation code:
AخA
 
var strings = [
    "6",
    "4",
    "3",
    "4",
    "1",
    "1",
    "5",
    "4",
    "1",
    "3",
    "2",
    "2",
    "5",
    "7",
    "1",
    "2",
    "1",
    "0",
    "5",
    "7",
    "4",
    "5",
    "0",
    "5",
    "1",
    "0",
    "4",
    "1",
    "7",
    "7",
    "0",
    "4",
    "0",
    "6",
    "3",
    "7",
    "7",
    "7",
    "5",
    "0",
    "0",
    "5",
    "0",
    "3",
    "3",
    "0",
    "5",
    "0",
    "2",
    "6",
    "2",
    "3",
    "3",
    "6",
    "2",
    "3",
    "0",
    "5",
    "5",
    "5",
    "6",
    "2",
    "3",
    "4",
    "4",
    "0",
    "7",
    "2",
    "3",
    "2",
    "6",
    "1",
    "4",
    "1",
    "1",
    "6",
    "5",
    "7",
    "4",
    "2",
    "5",
    "4",
    "6",
    "3",
    "4",
    "5",
    "4",
    "6",
    "1",
    "0",
    "3",
    "4",
    "7",
    "1",
    "0",
    "5",
    "4",
    "5",
    "3",
    "6"
];
Tests:
  • parseInt

     
    for (let s of strings) {
      let a = parseInt(s[0]);
    }
  • charCodeAt

     
    for (let s of strings) {
      let a = s.charCodeAt(0) - 48;
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    parseInt
    charCodeAt

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 months ago)
Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0
Firefox 133 on Linux
View result in a separate tab
Test name Executions per second
parseInt 1343293.8 Ops/sec
charCodeAt 1941532.6 Ops/sec