Grasshopper

algorithmic modeling for Rhino

Hello, I am very annoyed by a problem I have when running a certain script multiple times in a row. As you can see in the attached image, the script slows down dramatically on subsequent runs.

The idea behind it was to optimize the SurfaceSplit command when you input multiple surfaces to only call the component when the surfaces actually intersect. It uses a SurfaceClosestPoint to check if they intersect and if so performs the split.

I can't understand why each subsequent component runs slower than the former. I get the same behaviour if I turn the same component on and off in succession.

Could it be because of a memory problem which the script should handle? Or maybe the rhino (sr7) or grasshopper version (0.9.0068)?

I've also attached the script. Thank you for any ideas you could share.

Views: 2148

Attachments:

Replies to This Discussion

I was using a mixture of methods. After reading I ran some tests, it does seem that ghpythonlib.components are to be avoided, especially anywhere that is going to iterate.

Here's a .gif showing the change in my test definition (first find closest point on a list of curves, then find the closest of those points to the origin point), just from clicking 'recompute' 10 times.

(click for animated .gif)

The script components using ghpythonlib components (left column) increase in time from ~1.5s to ~20s while the ones using Rhino.Geometry methods (right column) remain constant.

Even with 50,000 input curves (this example is 5000) the all-Rhino.Geometry components are still only at ~1.3s

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service