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 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0
Browser:
Firefox 113
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Simple
1457070208.0 Ops/sec
Squared comparator
1669224704.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)