Is there a way to improve when the grashopper you made takes a long time?

Hello

I’m a drawing automation worker.
In this regard, to draw all the drawings, the grashopper file I made has been used very long and many different components such as anone, loop, and python.

Import is not a speed-repeated issue, and it just takes a very long time to run the entire code once (from 10 seconds to 1 minute 30 seconds at long)

I think this is the vulnerability of my grashopper.

Of course, when you write a lot of drawings, it can’t be helped that it takes a long time, but I still want to speed up the automation process.

Generally speaking, if you have experience such as how to speed up when using grashopper, how to increase the number of cores, or if you have experience like this in part, please let me know your help.

Thank you.

There are not exact ways to escape the process time when you have a large script or using to much Union operations such as Solid union , Solid Difference etc.
But in some cases you can reduce unnecessary data while using union operations , I mean you should have a well branched data tree so the the union only works with it’s related geometry , I know what I said might be a little confusing so I made an example to show :


the Solid Difference output is the same in these three components but you can see the difference in process time .(this issue is something that many people do not consider and of course it works fine when there is not to much geo’s but when it comes to high level computation , you have to consider it )

Another thing is that when you want to calculate the center of a polygon , what comes to mind quickly is using Area Component which allows us to have access to center point . but what we should consider is that computing area is a little heavy and when we just want the center , all we can do is to use Polygon Center Component , you can see it’s quite faster .

I’ll just conclude by saying most of the times we should sort and branch our data tree to get a faster result, and use correct components based on our need !

hope you find this helpful
cheers !

(I just quickly add another thing , I realized that you work with python in grasshopper , have you ever concidered to use old GhPython Script component ? It is much faster in some cases . you can load it by search for : # Ghpython script in the search bar )

Thank you. I’ll use all the methods you told me
The Python part is especially interesting

If you put components in the cluster and use them, will it take longer or something like that?

It doesn’t seem that clustering is going to affect that much because there are still the same components , ( but maybe because when you cluster there are some cluster inputs and outputs as gates , it’s gonna affect a little :))

Cheers !