Run details:
Mozilla/5.0 (Linux; Android 11; Joy 4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Mobile Safari/537.36
Chrome Mobile 100
Android
Mobile
2 years ago
Test name Executions per second
Switch 30552.9 Ops/sec
Object Literal 30343.2 Ops/sec
If Else 30108.4 Ops/sec
Object Literal defined outside function 30017.4 Ops/sec
Map 27023.7 Ops/sec
Map - defined outsid function 26674.0 Ops/sec
Script Preparation code:
Tests:
  • Switch

  • Object Literal

  • If Else

  • Object Literal defined outside function

  • Map

  • Map - defined outsid function