Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0
Firefox 97
Windows
Desktop
2 years ago
Test name Executions per second
Switch 87902.4 Ops/sec
Object Literal 86759.7 Ops/sec
If Else 88684.6 Ops/sec
Object Literal defined outside function 87077.6 Ops/sec
Map 78344.9 Ops/sec
Map - defined outsid function 77304.9 Ops/sec
Script Preparation code:
Tests:
  • Switch

  • Object Literal

  • If Else

  • Object Literal defined outside function

  • Map

  • Map - defined outsid function