With inline statements vs With min() and max() vs With if statements vs With ternary operator #1 vs With ternary operator #2Fastest: With if statements (19.6x faster)
170,417,792 ops/sec
165,053,248 ops/sec
162,430,608 ops/sec
162,169,600 ops/sec
8,712,377 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| With inline statements | |
| With min() and max() | |
| With if statements | |
| With ternary operator #1 | |
| With ternary operator #2 |
| Test name | Executions per second |
|---|---|
| ✓ With ternary operator #1 | 263,057,472 Ops/sec |
| With if statements | 261,649,552 Ops/sec |
| With min() and max() | 259,584,048 Ops/sec |
| With ternary operator #2 | 251,894,992 Ops/sec |
| With inline statements | 245,488,112 Ops/sec |