Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
includes vs. word starts with
(version: 1)
Searching for a substring: check whether it appears anywhere in a source string, or whether it appears at the start of a word within the source string
Comparing performance of:
Includes vs Word starts with
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ async function globalMeasureThatScriptPrepareFunction() { // This function is optional, feel free to remove it. // await someThing(); }
Tests:
Includes
const str = 'abc def ghi'; str.toLowerCase().includes('de');
Word starts with
const str = 'abc def ghi'; str.toLowerCase().split(' ').some(word => word.startsWith('de'));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Includes
Word starts with
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser/OS:
Chrome 134 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Includes
134633008.0 Ops/sec
Word starts with
14913088.0 Ops/sec
Related benchmarks:
Array.includes vs String.match
Array.includes vs String.match
Capitalize first char of a string
Capitalize first char of a string 2
JS string includes vs indexOf
Array.includes vs String compare v2
String.includes vs String.match 3
String.match vs String.includes
String.includes vs String.match vs String.indexOf
Comments
Confirm delete:
Do you really want to delete benchmark?