Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:126.0) Gecko/20100101 Firefox/126.0
Firefox 126
Windows
Desktop
6 months ago
Test name Executions per second
Switch 169494.3 Ops/sec
Object Literal 170604.9 Ops/sec
If Else 151978.2 Ops/sec
Object Literal defined outside function 144061.4 Ops/sec
Map 133859.3 Ops/sec
Map - defined outsid function 135079.3 Ops/sec
Script Preparation code:
Tests:
  • Switch

  • Object Literal

  • If Else

  • Object Literal defined outside function

  • Map

  • Map - defined outsid function