Hi Steven, 12ms that is a very good result.
One significant difference between compiled components and scripted ones is that script components does some kind of caching of the ports, while compiled components doesn't. Of course it takes some time to load also a compiled component, but not so much.
My own last trick to reduce the execution time of my compiled component another ~50% (from ~9 ms) was to add an extra in-port named
Invalidate (Default = True). The default value means normal function, while when set to False the component skips reading the pointlist inport, reusing the list which was already loaded in the last run.
Avoiding to invalidate an indata ports - in this case the point list - is useful when changing only the other parameters like position and inclination but not the number of points (which over time usually remains the same for a mesh). With Invalidate set to False my last score is ~7ms (while changing the other parameters with sliders). One component variant which only need to present the number of points, runs at 5ms.
If the internal point list is = 0 the property reads the inport regardless of the Invalidate setting. Like so :
Private m_Pts As New List(Of Point3d)
Protected ReadOnly Property InPts() As List(Of Point3d)
'// Update the Point cloud only if it hasn't been loaded yet.
If InInvalidate OrElse (m_Pts.Count = 0) Then
If m_Pts.Count = 0 Then
If Not m_DA.GetDataList(PortNo(InPrt.Pts), m_Pts) Then
Print("# Error - Invalid Point cloud input.")
Fig 1. OK, this one is extreme (for evaluating "score" only) but anyway (+2 ms for an output list with these points):
I don't know if it's possible to tweak a script component like this, but if you can, try this to see what you end up with.