Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
if else if [VS] if if
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Browser:
Chrome 121
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
if else if
9933717.0 Ops/sec
if if if ...
9617530.0 Ops/sec
Script Preparation code:
function testIf(val) { if (val < 0.2) { return '0.2'; } if (val < 0.4) { return '0.4'; } if (val < 0.6) { return '0.6'; } if (val < 0.8) { return '0.8'; } if (val < 1.0) { return '1.0'; } return '5' } function testIfElse(val) { if (val < 0.2) { return '0.2'; } else if (val < 0.4) { return '0.4'; } else if (val < 0.6) { return '0.6'; } else if (val < 0.8) { return '0.8'; } else if (val < 1.0) { return '1.0'; } else { return '5' } }
Tests:
if else if
testIfElse(Math.random())
if if if ...
testIf(Math.random())