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 710599.6 Ops/sec
Ternary 1273770.0 Ops/sec
Math.min 1189502.0 Ops/sec
Ternary min 1493304.0 Ops/sec
Math.max 1212649.0 Ops/sec
Ternary max 1635824.0 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