Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JS if/if vs if multiple conditions fixed
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/147.0.0.0 Safari/537.36 Edg/147.0.0.0
Browser:
Chrome 147
Operating system:
Windows
Device Platform:
Desktop
Date tested:
19 days ago
Test name
Executions per second
if/if
104187760.0 Ops/sec
if/else if
105902640.0 Ops/sec
Script Preparation code:
var test = 'test'
Tests:
if/if
if (test === 'test1' || test === 'test2' || test === 'test3' || test === 'test4' || test === 'test5') { return true; }
if/else if
if (test === 'test1') { return true; } else if (test === 'test2') { return true; } else if (test === 'test3') { return true; } else if (test === 'test4') { return true; } else if (test === 'test5') { return true; }