Script Preparation code:
Tests:

Historical Performance Data aggregated from 31 community runs

Desktop Results:
Chrome 31 runs
switch
8.0M/s
if/else
6.1M/s

Fastest: switch (1.3x faster)

View exact numbers
  • switch: 7,989,396 ops/sec
  • if/else: 6,122,403 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

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 days ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36 Edg/151.0.0.0
Chrome 151 on Windows
View result in a separate tab
if/else
8.9M/s
switch
8.8M/s
View exact numbers
Test name Executions per second
if/else 8,869,099 Ops/sec
switch 8,845,385 Ops/sec