Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
string match in list: array.includes vs if &&
(version: 1)
Comparing performance of:
if condition vs array.includes
Created:
10 months ago
by:
Registered User
Jump to the latest result
Tests:
if condition
((v) => { const a = 'a'; return a === 'adf' || a === 'a'; })('tuunreiro')
array.includes
((v) => { const a = 'a'; return [ 'adf', 'a', ].includes(a); })('tuunreiro')
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
if condition
array.includes
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
10 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Browser/OS:
Chrome 138 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
if condition
275317440.0 Ops/sec
array.includes
192652480.0 Ops/sec
Related benchmarks:
if comparison to array.includes
Includes vs. IndexOf v2
Array.includes vs String compare v2
array.includes or logical or
IF vs Array.includes()
array.includes vs if &&
array.includes vs if && vs ternary if &&
string match in list: if condition vs array.includes
string match in list: array.includes vs if condition ||
Comments
Confirm delete:
Do you really want to delete benchmark?