Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
string.charCodeAt(index) vs string[index].charCodeAt()
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Safari/605.1.15
Browser:
Safari 17
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
charCodeAt(300)
32.0M/s
charCodeAt(0)
31.8M/s
[0].charCodeAt()
24.1M/s
[300].charCodeAt()
23.9M/s
View exact numbers
Test name
Executions per second
✓
charCodeAt(300)
31,957,028 Ops/sec
charCodeAt(0)
31,846,490 Ops/sec
[0].charCodeAt()
24,080,684 Ops/sec
[300].charCodeAt()
23,939,364 Ops/sec
Script Preparation code:
var str = "some string heresome string heresome string heresome string heresome string heresome string heresome string heresome string heresome string heresome string heresome string heresome string heresome string heresome string heresome string heresome string heresome string heresome string heresome string here"
Tests:
charCodeAt(0)
str.charCodeAt(0)
charCodeAt(300)
str.charCodeAt(300)
[0].charCodeAt()
str[0].charCodeAt()
[300].charCodeAt()
str[300].charCodeAt()