Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
string match in list: array.includes vs if condition ||
(version: 1)
Comparing performance of:
if condition vs array.includes
Created:
10 months ago
by:
Guest
Jump to the latest result
Tests:
if condition
((v) => { if ( v === 'asdpopqnf' || v === 'zbvxcvuud' || v === 'qwtewoiru' || v === 'pojfopdgd' || v === 'tuunreiro' ) { return true; } return false; })('tuunreiro')
array.includes
((v) => { return [ 'asdpopqnf', 'zbvxcvuud', 'qwtewoiru', 'pojfopdgd', 'tuunreiro' ].includes(v); })('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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser/OS:
Chrome 137 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
if condition
91519272.0 Ops/sec
array.includes
50163184.0 Ops/sec
Related benchmarks:
if - strict vs truthy/falsy
or vs array vs set
ternary vs if
if/if VS if/or
546546518484
String falsy test
string match in list: switch case vs array.includes
string match in list: if condition vs array.includes
string match in list: array.includes vs if &&
Comments
Confirm delete:
Do you really want to delete benchmark?