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 (X11; Linux x86_64; rv:147.0) Gecko/20100101 Firefox/147.0
Browser:
Firefox 147
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 months ago
Test name
Executions per second
sqrt
37.0 Ops/sec
sqrt * direct
37.3 Ops/sec
hypot
37.2 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]); }