Run details:
Mozilla/5.0 (X11; CrOS x86_64 13729.84.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.130 Safari/537.36
Chrome 89
Chrome OS 13729.84.0
Desktop
3 years ago
Test name Executions per second
Math.min/max 575059.2 Ops/sec
Ternary 947722.3 Ops/sec
Math.min 1103090.6 Ops/sec
Ternary min 1409080.6 Ops/sec
Math.max 1105422.4 Ops/sec
Ternary max 1483220.2 Ops/sec
Script Preparation code:
Tests:
  • Math.min/max

  • Math.min

  • Math.max

  • Ternary clamp

  • Ternary min

  • Ternary max

  • Ternary clamp inlined

  • Ternary min inlined

  • Ternary max inlined