So i am mostly done with my script and it runs fine and just need some tuning and cleaning up/grouping/naming. This is the second one ive created and the first was really small and this became a bit bigger. So the question, is there a sweet spot for how many nodes one should have for general working purposes? Can it be more prone to crash the bigger it gets or is the sky the limit?
Also, are the some performance to be gained by setting up things in a specific sequence or should i not worry about that as long as things seems to be working?
As you’d expect, there are quite a few things that can affect performance. In general, the number of nodes you use will have little direct effect compared to what they’re actually doing. Basic functions like math, list management, and most conditional operations are lightweight and likely won’t have much affect on performance on their own. Heavier operations dealing with geometry or mass object changes (think Revit updates) will have a larger effect. Of course anytime you’re dealing with more objects your graph will take longer, but Revit transactions (or with any other application) are particularly time intensive.
Another thing to keep in mind is how Dynamo tracks outputs. Each output (either from a node or code block) is stored as a unique object, even if it’s a copy of another object. This means that your memory gets eaten up by every single output in your graph, whether it’s used, copied, modified, or ignored. So try not to have too many extra outputs.
Common best practices are to
- limit your graph to only the data and functionality required
- reuse data (don’t recreate it)
- minimize redundancy (don’t copy the same group of nodes 4 times for 4 different lists)
- use code blocks when possible to limit outputs
- use python when possible to increase performance, minimize redundancy, and limit outputs
- close and reopen regularly when testing larger graphs (to clear out memory)
There are better, more in-depth conversations about this topic throughout the forum if you want more recommendations.