Parallelising DA.SetData

Hi @aristocompasso,
If outputting is taking a long time, I’m assuming that you’re outputting a large number of objects (thousands of points, etc).

You’ll likely get much better performance by directly setting the Grasshopper type instead of outputting the Rhino type. For example, instead of DA.SetData(0, MyPoint3dList); you could use DA.SetData(0, MyPoint3dList.Select(x => new GH_Point(x));

This avoids the Cast functions, which are very expensive when called that many times.

As an example, generating and outputting 100,000 random points takes 565ms using Point3d, or 19ms when using the Linq conversion to GH_Point. Discussion here.

From memory this applies to compiled components in just the same way as it does to Script_Instance, but please correct me if I’m wrong.

1 Like