Run details:
Mozilla/5.0 (Linux; Android 10; ELE-L29) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.101 Mobile Safari/537.36
Chrome Mobile 98
Android
Mobile
2 years ago
Test name Executions per second
Switch 63416.9 Ops/sec
Object Literal 62525.0 Ops/sec
If Else 65801.0 Ops/sec
Object Literal defined outside function 66199.7 Ops/sec
Map 59535.4 Ops/sec
Map - defined outsid function 60583.9 Ops/sec
Script Preparation code:
Tests:
  • Switch

  • Object Literal

  • If Else

  • Object Literal defined outside function

  • Map

  • Map - defined outsid function