Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JS if/if vs if/or
Benchmark of the speed difference between using multiple IF statements and an open-ended IF/ELSE IF.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Browser:
Chrome 109
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
if/or
1.6M/s
if/if
1.6M/s
View exact numbers
Test name
Executions per second
✓
if/or
1,647,798 Ops/sec
if/if
1,641,014 Ops/sec
Script Preparation code:
var test = 'test5'
Tests:
if/if
if (test === 'test1') { return true; } if (test === 'test2') { return true; } if (test === 'test3') { return true; } if (test === 'test4') { return true; } if (test === 'test5') { return true; }
if/or
if (test === 'test1' || test === 'test2' || test === 'test3' || test === 'test4'|| test === 'test5') return true;