| Test case name | Result |
|---|---|
| Clamp from 0 to 255 using ternary | |
| Clamp from 0 to 255 using Min/Max | |
| Clamp from 0 to 255 with IF | |
| Clamp from 0 to 255 with unary && | |
| Clamp in arrow function with ternary | |
| Clamp in regular function with MinMax | |
| Clamp in arrow function with IF | |
| Clamp in regular function with unary |
| Test name | Executions per second |
|---|---|
| Clamp from 0 to 255 using ternary | 353034.6 Ops/sec |
| Clamp from 0 to 255 using Min/Max | 236481.4 Ops/sec |
| Clamp from 0 to 255 with IF | 764644.8 Ops/sec |
| Clamp from 0 to 255 with unary && | 770530.8 Ops/sec |
| Clamp in arrow function with ternary | 454706.2 Ops/sec |
| Clamp in regular function with MinMax | 198991.3 Ops/sec |
| Clamp in arrow function with IF | 440478.1 Ops/sec |
| Clamp in regular function with unary | 417289.2 Ops/sec |