Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
switch vs if js numbers
switch vs if
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:139.0) Gecko/20100101 Firefox/139.0
Browser:
Firefox 139
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
switch
930.5M/s
if
260.7M/s
View exact numbers
Test name
Executions per second
✓
switch
930,455,936 Ops/sec
if
260,697,504 Ops/sec
Tests:
if
const title = 5 if (title === 1) return if (title === 2) return if (title === 3) return if (title === 4) return if (title === 5) return
switch
const title = 5 switch (title) { case 1: return case 2: return case 3: return case 4: return case 5: return }