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/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)
31.9M/s
+[300]
31.4M/s
+[0]
31.2M/s
[0].charCodeAt()
24.3M/s
[300].charCodeAt()
24.3M/s
View exact numbers
Test name
Executions per second
✓
charCodeAt(300)
31,931,446 Ops/sec
+[300]
31,369,936 Ops/sec
+[0]
31,222,232 Ops/sec
[0].charCodeAt()
24,297,566 Ops/sec
[300].charCodeAt()
24,292,598 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])