Script Preparation code:
Tests:

Historical Performance Data aggregated from 18 community runs

Desktop Results:
Chrome 12 runs
switch
29.8M/s
if/else if
6.0M/s

Fastest: switch (5.0x faster)

View exact numbers
  • switch: 29,791,882 ops/sec
  • if/else if: 5,986,802 ops/sec
Firefox 6 runs
switch
117.4M/s
if/else if
109.1M/s
View exact numbers
  • switch: 117,351,144 ops/sec
  • if/else if: 109,098,544 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    switch
    if/else if

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 months ago)
Mozilla/5.0 (X11; Linux x86_64; rv:150.0) Gecko/20100101 Firefox/150.0
Firefox 150 on Linux
View result in a separate tab
switch
1104.7M/s
if/else if
100.5M/s
View exact numbers
Test name Executions per second
switch 1,104,700,288 Ops/sec
if/else if 100,542,312 Ops/sec