Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0
Firefox 89
Ubuntu
Desktop
3 years ago
Test name Executions per second
Math.min/max 1376644736.0 Ops/sec
Math.min 1374867968.0 Ops/sec
Math.max 1368345216.0 Ops/sec
Ternary clamp 1321500288.0 Ops/sec
Ternary min 1333998592.0 Ops/sec
Ternary max 1324718464.0 Ops/sec
Ternary clamp inlined 1280022400.0 Ops/sec
Ternary min inlined 1248335616.0 Ops/sec
Ternary max inlined 1243531008.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