Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
string.charCodeAt(index) vs string[index].charCodeAt() vs +string[index]
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Browser:
Chrome 119
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
charCodeAt(300)
31360856.0 Ops/sec
[0].charCodeAt()
31118672.0 Ops/sec
[300].charCodeAt()
31089326.0 Ops/sec
+[0]
31186612.0 Ops/sec
+[300]
31279084.0 Ops/sec
Script Preparation code:
var str = "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
Tests:
charCodeAt(300)
str.charCodeAt(300)
[0].charCodeAt()
str[0].charCodeAt()
[300].charCodeAt()
str[300].charCodeAt()
+[0]
+(str[0])
+[300]
+(str[300])