Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
branchless max vs Math.max (cached & uncached)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.6 Safari/605.1.15
Browser:
Safari 17
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
fastMax
4.5M/s
cached Math.max
4.3M/s
Math.max
4.0M/s
View exact numbers
Test name
Executions per second
✓
fastMax
4,473,288 Ops/sec
cached Math.max
4,333,355 Ops/sec
Math.max
4,039,007 Ops/sec
Script Preparation code:
var fastMax = (a, b) => (a - (((a - b) >> 31) & (a - b))); var max = Math.max;
Tests:
cached Math.max
max(Math.random(), Math.random(), Math.random())
fastMax
fastMax(Math.random(), Math.random(), Math.random())
Math.max
Math.max(Math.random(), Math.random(), Math.random())