Run details:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Mobile Safari/537.36
Chrome Mobile 126
Android
Mobile
5 months ago
Test name Executions per second
Switch 62608.4 Ops/sec
Object Literal 75963.9 Ops/sec
If Else 39592.0 Ops/sec
Object Literal defined outside function 59427.5 Ops/sec
Map 51919.8 Ops/sec
Map - defined outsid function 31837.2 Ops/sec
Script Preparation code:
Tests:
  • Switch

  • Object Literal

  • If Else

  • Object Literal defined outside function

  • Map

  • Map - defined outsid function