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:
one year ago
by:
Guest
Go 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:
one year 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
if condition
91.5M/s
array.includes
50.2M/s
View exact numbers
Test name
Executions per second
✓
if condition
91,519,272 Ops/sec
array.includes
50,163,184 Ops/sec
Related benchmarks
if - strict vs truthy/falsy
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?