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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Browser:
Chrome 130
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
charCodeAt(300)
8.5M/s
+[300]
8.4M/s
[0].charCodeAt()
8.4M/s
+[0]
8.3M/s
[300].charCodeAt()
8.1M/s
View exact numbers
Test name
Executions per second
✓
charCodeAt(300)
8,480,823 Ops/sec
+[300]
8,421,745 Ops/sec
[0].charCodeAt()
8,356,395 Ops/sec
+[0]
8,344,734 Ops/sec
[300].charCodeAt()
8,086,396 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])