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 693489.2 Ops/sec
Ternary 1179709.6 Ops/sec
Math.min 1169593.9 Ops/sec
Ternary min 1495768.8 Ops/sec
Math.max 1289345.6 Ops/sec
Ternary max 1753328.6 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