Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
sqrt vs hypot
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0
Browser:
Chrome 134
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
sqrt
18.5 Ops/sec
sqrt * direct
12.4 Ops/sec
hypot
4.7 Ops/sec
Script Preparation code:
const N = 1e7; const values = new Array(N).fill(0).map(() => [Math.random(), Math.random()]);
Tests:
sqrt
for (let i = 0; i < N; i++) { Math.sqrt(values[i][0] ** 2 + values[i][1] ** 2); }
sqrt * direct
for (let i = 0; i < N; i++) { Math.sqrt(values[i][0] * values[i][0] + values[i][1] * values[i][1]); }
hypot
for (let i = 0; i < N; i++) { Math.hypot(values[i][0], values[i][1]); }