Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
distance calculations
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:132.0) Gecko/20100101 Firefox/132.0
Browser:
Firefox 132
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
hypot
1794.4 Ops/sec
sqrt
2149.8 Ops/sec
sqrt + pow
1567.1 Ops/sec
i*i
2657.8 Ops/sec
pow
1740.0 Ops/sec
Script Preparation code:
function testHypot() { for (let i=0; i < 1000; i++){ for (let j=0; j < 1000; j++) { Math.hypot(i, j) } } } function testSqrt() { for (let i=0; i < 1000; i++){ for (let j=0; j < 1000; j++) { Math.sqrt(i*i+j*j) } } } function testSqrtAndPow() { for (let i=0; i < 1000; i++){ for (let j=0; j < 1000; j++) { Math.sqrt(Math.pow(i,2)+Math.pow(j,2)) } } } function testNoSqrt() { for (let i=0; i < 1000; i++){ for (let j=0; j < 1000; j++) { i*i+j*j } } } function testNoSqrtAndPow() { for (let i=0; i < 1000; i++){ for (let j=0; j < 1000; j++) { Math.pow(i,2)+Math.pow(j,2) } } }
Tests:
hypot
testHypot()
sqrt
testSqrt()
sqrt + pow
testSqrtAndPow()
i*i
testNoSqrt()
pow
testNoSqrtAndPow()