For those that are not aware, using the Vector2.Distance() method is extremely slow compared to just doing the calculation…

By a factor of around 3.4+ times slower…

When I ran it:

diff2 was 67.9991

diff3 was 236.0034

Fairly significant difference.

Some Test Code:

```
DateTime startTime;
DateTime endTime;
double answer;
double diff2;
double diff3;
Vector2 pos1 = new Vector2(10, 10);
Vector2 pos2 = new Vector2(50, 50);
startTime = DateTime.Now;
for (int i = 0; i < 10000000; i++)
{
pos1.X = 100;
pos1.Y = 100;
pos2.X = 500;
pos2.Y = 500;
answer = Math.Sqrt((pos2.X - pos1.X) * (pos2.X - pos1.X) + (pos2.Y - pos1.Y) * (pos2.Y - pos1.Y));
}
endTime = DateTime.Now;
diff2 = (endTime - startTime).TotalMilliseconds;
startTime = DateTime.Now;
for (int i = 0; i < 10000000; i++)
{
pos1.X = 100;
pos1.Y = 100;
pos2.X = 500;
pos2.Y = 500;
answer = Vector2.Distance(pos1, pos2);
}
endTime = DateTime.Now;
diff3 = (endTime - startTime).TotalMilliseconds;
```