Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
parseInt vs charCodeAt
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0
Browser:
Firefox 133
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
parseInt
1343293.8 Ops/sec
charCodeAt
1941532.6 Ops/sec
Script Preparation code:
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; }