Recently stumbled into an interesting effect in Grasshopper while developing a component for parametric definition of numerical models.
To easily access outputs of the code within the grasshopper I utilised DataTree structures.
I run into the performance issue where code was taking significantly longer than expected to generate geometry (NurbsSurfaces + Points3d). After some analysis I was surprised to find out that the majority of time > 95% was spend not on calculations but on storage of Rhino geometry entities within the DataTree structure.
Replacing DataTree with the nested List structure addresses the issue. It is curious to note that this slow down was only present for the geometric entities and not for the integer storage.
Mock code for this to occur:
for (int ii = 0; ii < num_1; ii++)
{
`for (int jj= 0; jj< num_2; jj++)`
{
for (int kk = 0; kk< num_3; kk++)
{
List<NurbsSurface> vol_face = Vol_Face_Geom_Constr(some_inputs);
GH_Path e_path = new GH_Path(ii, jj, kk);
mesh3d_geom.AddRange(vol_face, e_path);
}
}
}
If anyone has any ideas what is occurring here, or even some workarounds, it would be nice if you could share you experience.
4 posts - 2 participants