What's faster: (a - b).Length or a.DistanceTo(b)?

How do I even calculate time?

Iā€™d get a reliable clock.

1 Like

DistanceTo seems to be tiny little bit faster (on rhino 6).
Even it it was vice versa, I would still use DistanceTo, as it is more readable.

import Rhino
import time

pt1 = Rhino.Geometry.Point3d(10,20,0)
pt2 = Rhino.Geometry.Point3d(200,100,0)

t1 = time.time()

for i in xrange(100000):
    dist1 = (pt2-pt1).Length

t2 = time.time()

for i in xrange(100000):
    dist2 = pt1.DistanceTo(pt2)

t3 = time.time()

print ("t2: ", t2-t1)
print ("t3: ", t3-t2)