Script Preparation code:
Tests:
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • 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

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Chrome 125 on Linux
View result in a separate tab
Clamp from 0 to 255 with unary &&
771K/s
Clamp from 0 to 255 with IF
765K/s
Clamp in arrow function with ternary
455K/s
Clamp in arrow function with IF
440K/s
Clamp in regular function with unary
417K/s
Clamp from 0 to 255 using ternary
353K/s
Clamp from 0 to 255 using Min/Max
236K/s
Clamp in regular function with MinMax
199K/s
View exact numbers
Test name Executions per second
Clamp from 0 to 255 with unary && 770,531 Ops/sec
Clamp from 0 to 255 with IF 764,645 Ops/sec
Clamp in arrow function with ternary 454,706 Ops/sec
Clamp in arrow function with IF 440,478 Ops/sec
Clamp in regular function with unary 417,289 Ops/sec
Clamp from 0 to 255 using ternary 353,035 Ops/sec
Clamp from 0 to 255 using Min/Max 236,481 Ops/sec
Clamp in regular function with MinMax 198,991 Ops/sec