Script Preparation code:
Tests:
  • 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

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: 5 months 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
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


;