Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
string match in list: if condition vs array.includes
(version: 1)
Comparing performance of:
switch case vs array.includes
Created:
10 months ago
by:
Guest
Jump to the latest result
Tests:
switch case
((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
switch case
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
switch case
93700992.0 Ops/sec
array.includes
50987800.0 Ops/sec
Related benchmarks:
switch vs if else vs do while vs object
or vs array vs set
ternary vs if
Switch true vs if else
546546518484
if else vs switch case vs indexOf 2
string match in list: switch case vs array.includes
string match in list: array.includes vs if condition ||
string match in list: array.includes vs if &&
Comments
Confirm delete:
Do you really want to delete benchmark?