Run details:
Mozilla/5.0 (Linux; Android 12) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Mobile Safari/537.36
Chrome Mobile 98
Android
Mobile
2 years ago
Test name Executions per second
Switch 91645.0 Ops/sec
Object Literal 86812.1 Ops/sec
If Else 86645.1 Ops/sec
Object Literal defined outside function 83864.8 Ops/sec
Map 70905.6 Ops/sec
Map - defined outsid function 68093.0 Ops/sec
Script Preparation code:
Tests:
  • Switch

  • Object Literal

  • If Else

  • Object Literal defined outside function

  • Map

  • Map - defined outsid function