Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Math.max vs. if vs. ternary
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/131.0.6778.154 Mobile/15E148 Safari/604.1
Browser:
Chrome Mobile iOS 131
Operating system:
iOS 18.1.1
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
Math.max
454065792.0 Ops/sec
If
264756832.0 Ops/sec
Ternary
454306976.0 Ops/sec
Script Preparation code:
this.number = Math.random() * 1000;
Tests:
Math.max
return this.number < 500 ? 500 : this.number;
If
if (this.number < 500) { return 500; } return this.number;
Ternary
return this.number < 500 ? 500 : this.number;