Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Check first character
(version: 0)
Comparing performance of:
regexp .test() vs String match vs Start startsWith vs String charAt vs String indexOf
Created:
4 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var value = "Fourscore and seven years"
Tests:
regexp .test()
/^F.*/.test(value)
String match
value.matches(/^F.*/)
Start startsWith
value.startsWith('F')
String charAt
value[0]==='F'
String indexOf
value.indexOf('F')===0
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (5)
Previous results
Fork
Test case name
Result
regexp .test()
String match
Start startsWith
String charAt
String indexOf
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
String from Charcode test
String from Charcode test with ...
String from Charcode test 2
parseInt vs charCodeAt
String from Charcode cached (deg)
Comments
Confirm delete:
Do you really want to delete benchmark?