Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
test switch vs map
(version: 1)
Comparing performance of:
Switch vs Map
Created:
one year ago
by:
Guest
Jump to the latest result
Tests:
Switch
const input = 10; switch(input) { case 1: return true; case 2: return true; case 3: return true; default: return false; }
Map
const input = 10; const myMap = new Map([ [0, true], [1, true], [2, true], [3, true] ]); if(myMap.has(input)){ return myMap[input]; } else { return false; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Switch
Map
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
13 days ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:149.0) Gecko/20100101 Firefox/149.0
Browser/OS:
Firefox 149 on Mac OS X 10.15
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Switch
1540441088.0 Ops/sec
Map
12592698.0 Ops/sec
Related benchmarks:
Switch vs map
Switch vs new Map
Switch vs javascript map
Switch vs Map object
my test bench 1
Switch vs map test2
Switch vs object mapping
Switch vs object mapping 3
test switch vs map 2
Comments
Confirm delete:
Do you really want to delete benchmark?