Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
sqrt vs hypot
(version: 1)
Comparing performance of:
sqrt vs sqrt * direct vs hypot
Created:
one year ago
by:
Registered User
Jump to the latest result
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]); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
sqrt
sqrt * direct
hypot
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 months ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:147.0) Gecko/20100101 Firefox/147.0
Browser/OS:
Firefox 147 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
sqrt
37.0 Ops/sec
sqrt * direct
37.3 Ops/sec
hypot
37.2 Ops/sec
Related benchmarks:
reduce vs loop
reduce vs loop
Powers of two
Powers of two
Math.pow() versus **
This site broken
for vs reduce (find max value)
for vs reduce (find max value) i10000
Math.floor(N) vs (N | 0) vs parseInt(N)
Comments
Confirm delete:
Do you really want to delete benchmark?