Script Preparation code:
Tests:

Historical Performance Data aggregated from 15 community runs

Desktop Results:
Chrome 9 runs
switch
142.3M/s
if/else if
136.6M/s
View exact numbers
  • switch: 142,257,616 ops/sec
  • if/else if: 136,604,368 ops/sec
Firefox 6 runs
if/else if
1394.2M/s
switch
1391.1M/s
View exact numbers
  • if/else if: 1,394,189,056 ops/sec
  • switch: 1,391,089,792 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: 4 months ago)
Mozilla/5.0 (X11; Linux x86_64; rv:147.0) Gecko/20100101 Firefox/147.0
Firefox 147 on Linux
View result in a separate tab
switch
1876.2M/s
if/else if
1869.8M/s
View exact numbers
Test name Executions per second
switch 1,876,157,696 Ops/sec
if/else if 1,869,812,736 Ops/sec