Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
startsWith vs substring vs indexOf
(version: 0)
startsWith vs substring vs indexOf
Comparing performance of:
startsWith vs substring vs indexOf
Created:
4 years ago
by:
Registered User
Jump to the latest result
Tests:
startsWith
let s_test = '0x101010'; if (s_test.startsWith('0x')) s_test = s_test.slice(2);
substring
let s_test = '0x101010'; if (s_test.substring(0, 2) === "0x") s_test = s_test.slice(2);
indexOf
let s_test = '0x101010'; if (s_test.indexOf("0x") === 0) s_test = s_test.slice(2);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
startsWith
substring
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:
indexOf vs substr vs startsWith
index vs lastindexof startsWith
String indexOf vs startsWith/endsWith
Js Search - String StartsWith vs Includes
String indexOf() === 0 vs. startsWith()
Comments
Confirm delete:
Do you really want to delete benchmark?