Test case name | Result |
---|---|
Switch 1 case | |
Switch 1k cases | |
Object 50 props | |
If-else 50 cases | |
Switch 50 cases | |
Object 10 props | |
If-else 10 cases | |
Switch 10 cases | |
Object 4 props | |
If-else 4 cases | |
Switch 4 cases | |
Object 2 props | |
If-else 2 cases | |
Switch 2 cases | |
Object 1 prop | |
If-else 1 case | |
If-else 1k cases | |
Object 1k props |
Test name | Executions per second |
---|---|
Switch 1 case | 7859577.0 Ops/sec |
If-else 1 case | 7285117.0 Ops/sec |
Object 1 prop | 7319591.0 Ops/sec |
Switch 2 cases | 7270051.0 Ops/sec |
If-else 2 cases | 7195069.0 Ops/sec |
Object 2 props | 7296113.0 Ops/sec |
Switch 4 cases | 7075264.0 Ops/sec |
If-else 4 cases | 7083037.5 Ops/sec |
Object 4 props | 7195069.0 Ops/sec |
Switch 10 cases | 6637338.0 Ops/sec |
If-else 10 cases | 6710458.0 Ops/sec |
Object 10 props | 7125070.0 Ops/sec |
Switch 50 cases | 5714871.5 Ops/sec |
If-else 50 cases | 5789916.0 Ops/sec |
Object 50 props | 7579505.0 Ops/sec |
Switch 1k cases | 983385.6 Ops/sec |
If-else 1k cases | 968757.2 Ops/sec |
Object 1k props | 7416455.5 Ops/sec |