Run details:
Mozilla/5.0 (Linux; Android 12; Pixel 4a Build/SQ1A.220205.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/98.0.4758.101 Mobile Safari/537.36 [FB_IAB/Orca-Android;FBAV/351.1.0.12.114;]
Chrome Mobile 98
Android
Mobile
2 years ago
Test name Executions per second
Switch 51104.4 Ops/sec
Object Literal 53533.9 Ops/sec
If Else 51434.2 Ops/sec
Object Literal defined outside function 53020.8 Ops/sec
Map 44384.9 Ops/sec
Map - defined outsid function 42293.2 Ops/sec
Script Preparation code:
Tests:
  • Switch

  • Object Literal

  • If Else

  • Object Literal defined outside function

  • Map

  • Map - defined outsid function