Run details:
Mozilla/5.0 (Linux; Android 10; JNY-LX1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.127 Mobile Safari/537.36
Chrome Mobile 85
Android
Mobile
2 years ago
Test name Executions per second
Switch 36420.9 Ops/sec
Object Literal 36023.4 Ops/sec
If Else 35655.6 Ops/sec
Object Literal defined outside function 35381.9 Ops/sec
Map 33170.5 Ops/sec
Map - defined outsid function 32472.9 Ops/sec
Script Preparation code:
Tests:
  • Switch

  • Object Literal

  • If Else

  • Object Literal defined outside function

  • Map

  • Map - defined outsid function