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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Simple
78548304.0 Ops/sec
Squared comparator
78982248.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)