Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0
Firefox 101
Windows
Desktop
2 years ago
Test name Executions per second
Switch 71541.5 Ops/sec
Object Literal 70495.2 Ops/sec
If Else 80002.0 Ops/sec
Object Literal defined outside function 74576.7 Ops/sec
Map 65315.0 Ops/sec
Map - defined outsid function 68592.9 Ops/sec
Script Preparation code:
Tests:
  • Switch

  • Object Literal

  • If Else

  • Object Literal defined outside function

  • Map

  • Map - defined outsid function