algorithmic modeling for Rhino
Hi,
I use in my vb component a list of list of Object as an input (for each "sublist", 2 Point3d and 1 Integer), and use it to store values in an array. The storing process uses 290 193 loops. This needs 14 sec to calculate, wich is really long.
Here is my script, where ddf is the list of list, and elts a list of Point3d.
For i = 0 To elts.Count - 1
For j = 0 To ddf.Count - 1
If elts(i).From = ddf(j)(0) And elts(i).To = ddf(j)(1) Then
tabElts(i, 2) = ddf(j)(2)
ddf.RemoveAt(j)
Exit For
End If
Next
Next
If I decompose my list of list into a list of point3d and a list of integers, the calculation time drastically decrease (0.27 sec), even if the number of loops is 2.5 times higher (724 500).
I would prefer to use the first script, as it uses less loops, but it is too slow (my test concerns a mesh with 441 points, but I am going to use this for much bigger meshes). I don't understand why. Is it to be known that the use of list of list of different types of objects is very time consumer ? Did I make a mistake in my script ?
Thanks for your help
Tags:
Replies are closed for this discussion.
Hi Guillaume,
Can you post a GH example of both scripts and the Rhino mesh example you are testing?
This way, I can repeat the test at my end.
Thanks.
Hi Rajaa,
Thanks for your help. I gave up with the script using lists of lists of Objects. I was told that it was quite logical that it took longer time to calculate, because the datas are stored in different locations in the memory and so it is longer to read than a single array or list.
And with some optimisation, my script using several lists instead is now quite efficient.
Is that true that C# components are faster than vb.net ones ?
There shouldn't be any difference between using C# or VB components.
If you are interested in more details, here is one discussion:
http://stackoverflow.com/questions/1223660/is-c-sharp-code-faster-t...
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by