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 1376645000.0 Ops/sec
Math.min 1374868000.0 Ops/sec
Math.max 1368345000.0 Ops/sec
Ternary clamp 1321500000.0 Ops/sec
Ternary min 1333999000.0 Ops/sec
Ternary max 1324718000.0 Ops/sec
Ternary clamp inlined 1280022000.0 Ops/sec
Ternary min inlined 1248336000.0 Ops/sec
Ternary max inlined 1243531000.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