Run details:
Mozilla/5.0 (Android 11; Mobile; rv:102.0) Gecko/102.0 Firefox/102.0
Firefox Mobile 102
Android
Mobile
2 years ago
Test name Executions per second
Switch 46348.4 Ops/sec
Object Literal 43727.5 Ops/sec
If Else 44365.8 Ops/sec
Object Literal defined outside function 42690.8 Ops/sec
Map 39265.3 Ops/sec
Map - defined outsid function 38425.2 Ops/sec
Script Preparation code:
Tests:
  • Switch

  • Object Literal

  • If Else

  • Object Literal defined outside function

  • Map

  • Map - defined outsid function