Run details:
Mozilla/5.0 (Linux; Android 8.0.0; ASUS_X00RD) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Mobile Safari/537.36
Chrome Mobile 70
Android 8.0.0
Mobile
3 years ago
Test name Executions per second
Math.min/max 187836.7 Ops/sec
Ternary 301941.7 Ops/sec
Math.min 291517.3 Ops/sec
Ternary min 442841.1 Ops/sec
Math.max 283965.2 Ops/sec
Ternary max 427813.5 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