Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Euclidean distance comparison
A demonstration of efficient and inefficient eculidean distance comparisons
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0
Browser:
Firefox 133
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Simple
1857689984.0 Ops/sec
Squared comparator
1638046720.0 Ops/sec
Script Preparation code:
pointA = { x: 1, y: 2}; pointB = { x: 10, y: 5}; maxDistance = 4;
Tests:
Simple
Math.sqrt(Math.pow(pointA.x - pointB.x, 2) + Math.pow(pointA.y - pointB.y, 2)) < maxDistance
Squared comparator
(Math.pow(pointA.x - pointB.x, 2) + Math.pow(pointA.y - pointB.y, 2)) < Math.pow(maxDistance, 2)