I am using python to build my code, but I didn’t unwrapelement into python. I just simply use the design script code like distanceto to build up my code. Maybe I ask, is it much faster to unwrap everything to use revitapi directly? coz I am using 3-4 for loop and some if statement together
by the way, what is the benefit of importing operator like lt gt but not use < > ? is it much faster?
Unwrapping is typically not related to saving time, it is related to exposing an object to the Revit API (Dynamo deals with objects without needing to unwrap them when we pass them around outside Python - the OOTB nodes know what they’re doing). If you are doing many steps in one Python node then yes often it can be done more quickly and with access to iteration and if/try/except statements you can often do things not available in visual programming.
There is a good video/resource made by @john_pierson (who can probably give a more well explained/worded answer than me on this topic as well) which recently showed speed difference between a node/python/zero touch setup. The finding was that Python as a node for node approach is not as effective in regards to time, whilst zero touch nodes are rather effective. Once you build ‘workflows’ inside a Python script or zero touch node I expect both would likely outperform a set of nodes. The tuneup extension can help assess this quite well.
very useful!!!
Every node inside of Dynamo has a memory overhead as it caches the results (So geometry has a higher one). This is done in service of inspectability at every stage for users that comes at a performance cost ![]()
Any workflow inside of Python that does a bunch of things, and only returns the desired end-result into Dynamo will be faster as this memory overhead isn’t there (Interim steps are garbage collected and the memory is free’d up) - and only the returned value is.
This is true of both Python and ZeroTouch (C#) conceptually, and the difference between these two languages is that C# is compiled (Figures a lot out beforehand) and Python is Interpreted (Figures it out on the fly).