Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
bunch of ifs vs switch
(version: 0)
Comparing performance of:
1 vs 2 vs 3
Created:
5 years ago
by:
Guest
Jump to the latest result
Tests:
1
function getSupportedFormat(adaptiveLibrary){ var supportedFormat = ['mp4']; if (adaptiveLibrary == 'shaka') supportedFormat = ['dash', 'mp4']; else if (adaptiveLibrary == 'bitmovin') supportedFormat = ['hls', 'dash', 'mp4']; else if (adaptiveLibrary == 'hls') supportedFormat = ['hls', 'mp4']; return supportedFormat; } getSupportedFormat('hls')
2
function getSupportedFormat(adaptiveLibrary){ var supportedFormatsMap = { shaka:['dash', 'mp4'], bitmovin:['hls', 'dash', 'mp4'], hls:['hls', 'mp4'] }; return supportedFormatsMap[adaptiveLibrary] || ['mp4']; } getSupportedFormat('hls')
3
function getSupportedFormat(adaptiveLibrary){ switch(adaptiveLibrary){ case 'shaka': return ['dash', 'mp4']; break; case 'bitmovin': return ['hls', 'dash', 'mp4']; break; case 'hls': return ['hls', 'mp4']; break; default: return ['mp4']; } } getSupportedFormat('hls')
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
1
2
3
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Switch vs If else CNC
JS switch vs if/else if
map vs ifelse vs switch test
JS if/if vs if/else if vs switch
if/switch1
Comments
Confirm delete:
Do you really want to delete benchmark?