Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
Chrome 113
Linux
Desktop
one year ago
Test name Executions per second
Switch 265861.2 Ops/sec
Object Literal 249954.5 Ops/sec
If Else 231467.4 Ops/sec
Object Literal defined outside function 244723.1 Ops/sec
Map 219305.0 Ops/sec
Map - defined outsid function 213460.5 Ops/sec
Script Preparation code:
Tests:
  • Switch

  • Object Literal

  • If Else

  • Object Literal defined outside function

  • Map

  • Map - defined outsid function