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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser:
Chrome 136
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
switch
88.1M/s
if
81.2M/s
View exact numbers
Test name
Executions per second
✓
switch
88,107,840 Ops/sec
if
81,158,824 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 }