Curve.ClosestPoints run time

Curve.ClosestPoints runs considerably longer in V6 than in V5 when analyzing the curve and surface in Curve_ClosestPoints.3dm (142.1 KB). This can also be seen using _ClosestPt _Object.

import rhinoscriptsyntax as rs
import scriptcontext as sc
import time

def main():
    idBrep = rs.GetObject("Select surface", filter=rs.filter.surface, preselect=True)
    if idBrep is None: return
    idCrv = rs.GetObject("Select curve", filter=rs.filter.curve)
    if idCrv is None: return
    face = rs.coercesurface(idBrep)
    crv = rs.coercecurve(idCrv)
    t0 = time.time()
    crv.ClosestPoints([face], sc.doc.ModelAbsoluteTolerance)
    print time.time() - t0

if __name__ == '__main__': main()

Thank you,

Rhino 6.0.16257.13261, 9/13/16

Hi Steve - here, V5 is marginally slower - 0.536880493164 vs. 0.513648986816 in V6.


I’m getting about 0.68 seconds in V5 and about 7.3 seconds in V6. A noticeable run time difference occurs with other, but not most, curve/surface combinations.

Also, _ClosestPt _Object runs slower than my script in both V5 & V6.

Are you comparing 32-bit V5 to 64-bit V6?

Not quite as fast as yours, but same general result (after 5 runs):




No, V5 is also 64-bit, but the problem is with V6. My PC is running Windows 7 Professional SP1.

After a reboot, V6 takes over 15 seconds to run. V5’s run time is the same as before (similar to Mitch’s results).

With the last section of the function changed to the following, V6 takes about 22 seconds, whereas V5 takes about 0.8 second.

    t0 = time.time()
    rs.Command("_ClosestPt _Object _SelID " + str(idCrv))
    print time.time() - t0

Hi Steve,

I am unable to reproduce the slowness you are reporting with your sample function. The Rhino WIP is always slightly quicker that Rhino 5 64-bit.

I wrote the equivalent script using RhinoScript and the results were similar.

I’m running Windows 10 on an i7 system with 16 GB of RAM.

Not sure where to go from here…

– Dale

1/26 WIP
Last weekend, I tested the curve and surface using older versions of the WIP. The January 26th WIP was the earliest that could read the model. Although I could not use the IronPython plug-in, _ClosestPt _Object was taking over 20 seconds to complete, the same as last week’s WIP.

9/13 WIP
Through repeated testing of the script using a loop, I was getting times that were always about 0.54, 7.3, 15.1, or 21.7. Sometimes the timing would be near one value for a few iterations then jump to and remain near another value through the remainder of the loop. Does a pattern like this indicate anything?

9/20 WIP
Running the script through 100 iterations, the times ranged from 2.76 to 3.04, values I had not witnessed previous to this WIP. (V5 times are still about 0.68.)

_ClosestPt _Object now takes less than 4 seconds to complete in the WIP. The script reports about 3.2.

Besides installing the new WIP, I haven’t made other changes to my PC since testing last week’s WIP. Could something else be throttling the WIP but not V5?

By the way
After installing a WIP, for the first or first few times after closing it, I often get the “Rhinoceros 6 Developer Build has stopped working” window with the option to send information to Microsoft. This has been happening for some time, possibly since I’ve started using the WIP last November.