Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36
Chrome 85
Windows
Desktop
4 years ago
Test name Executions per second
Math.max/min 530653.4 Ops/sec
if 1464698.8 Ops/sec
ternary 1609598.2 Ops/sec
bitwise 735848.1 Ops/sec
& ~~ 724389.8 Ops/sec
lodash clamp 809511.1 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • Math.max/min

  • if

  • ternary

  • bitwise

  • & ~~

  • lodash clamp