Grasshopper

algorithmic modeling for Rhino

Does converting a GH definition into Python speed it up???

Hi All,

I have been working on a definition lately that generates form using a number "split surface" and solid intersection functions.

The definition takes time to compute, used to be around 7 seconds, now it takes between 2-3, which is not bad.

However I was wondering, if do the same by calling GH components into Python, would that help by itself speed things up?

I read this post almost a year ago by Steve Baer, that explains how to apply parallel computing on Python in GH. I have never tried this? Has anyone?

And to extend this even further, if I do the same definition completely in Python under rhino (not that I know how to) instead of under GH, would that make a difference?

Thanks a lot in advance.

Omar

PS. I have a fairly fast computer with 4-core, 8 thread Core i7 with a mild factory over-clocking

Views: 1198

Replies to This Discussion

This is properly something David only can answer for sure.

However what I have noticed is that parsing data between components takes time. So normal if you replace all components by one script component it gets faster. Further scripting enables to write certain operations differently e.g. you can use loops. (here you have to be careful with the profile the first time you run the script it also compiles it, when rerun it gets faster...)

The parallel option in the post would also speed it up.

Yes and mot likely if you would write a Rhino command it would be faster again.

Richard

 

It depends on pretty much every element involved.

Typically when an operation is encoded in C# or Python it is faster as Grasshopper doesn't have to worry about previews and UI updates and object states, and events. However if the bulk of the time is spend doing intense geometry calculations then the difference will be difficult to measure.

Thanks Richard and David,

I tried it, a simple trial based on Steve Baer's example, but I ran into further problems.

When I tried to replicate the "Region Difference" component in Python, it ran without errors, but the result was totally different from the GH component   :(    Off course it shows a significant drop in processing time (almost a third of the time required.

When I tries applying the parallel solver in Python, it didn't work and returns an error...

Attached are the files for your reference.

Attachments:

I think I better split this into a separate discussion

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service