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 91531.0 Ops/sec
Object Literal 102188.6 Ops/sec
If Else 88591.7 Ops/sec
Object Literal defined outside function 92995.4 Ops/sec
Map 85326.7 Ops/sec
Map - defined outsid function 91241.9 Ops/sec
Script Preparation code:
Tests:
  • Switch

  • Object Literal

  • If Else

  • Object Literal defined outside function

  • Map

  • Map - defined outsid function