Major difficulty with how long it takes to run a dynamo script

Hello, I am having a problem with how long it takes to run a script. I am having a really weird problem with it.
at first, my script only took like 3 or 4 min to run on my test model, and about 30 min on the main model our live models that have our actual projects linked into it (the one for work) Then I added some changes and it jumped all the way up to about 17min to run it. and took 2-1/2 hours on the main model. I started to analyze what was taking the longest time to run, so I used the Laptime nodes from clockwork, and found that a new way to do a particular part of my script that one node in particular took about 7 min to run.
So I was like ok, ill Freeze this stuff (that node and its connected nodes) and redo it back to the way I had it before. I did that and then ran it again. And it ran at 4min and 55sec! I was ecstatic! But then, I shut dynamo down and the Revit practice project, to clear my memory and ran it again, and it took over 15min to run this time around after I have made no changes, what-so-ever. What happened here?
Also, I noticed that every time I run the script consecutively, it takes about a minute to a minute-and-a-half to longer to run each time! Is this a memory leak? I tried everything, even restarting my computer but it behaves the same way every time.

Then I tried to run it on the main model, (while I worked on other things) a let it run for over 5 hours, and it never completed. Just stopped responding. Now, I fear the same thing is going to happen today. I started it over 3-1/2 hours ago today and its still running. I don’t want to touch it because I am afraid it will crap out on me, and I really need this script to work or my boss is going to kill me! I have to get this thing down to a working time like ~1hr per run, or its my butt. Is anyone willing to take a look at it for me? I can give you my practice model and my script if you tell me how to send it to you.

Anyone else know why Dynamo is so painfully slow to run in general? I am using Dynamo 1.3.4 Thanks!

Sounds like you may be up against element binding which has been made much faster in the updates. More info on this topic can be found here (though I don’t think I directly cover the old versions): Element Binding in Revit

If you don’t see bindings in the file, or are lost due to the difference in file type (somewhat unlikely as it’s actually easier in 1.x) post the dyn file directly to the forum or a link to an external share service (Google Drive, Dropbox, Onedrive, Box, etc.) and I will try to have a look later today.

Hello, I will upload it later today. I am reading your post about element binding now. But I cannot open your dynamo file. it says its corrupt.
image

It’s not corrupted, just in a newer version of Dynamo, and thats ok
Maybe you can try to update, most of your scripts won’t notice its been updated, but you can’t go back once you saved the graph, so make a new folder and use SaveAs and you are good.

Hello @jacob.small
In your post you seem to suggest that element binding only occurs when element are created in revit from dynamo. Is that correct? I am not creating any elements in revit with my script. This is a read only script, and writing that data to excel. So if element binding isn’t my issue, what is?

Also, you mentioned in your post: " 1. Open a new Revit file, then open the .dyn in Dynamo, disconnect all nodes which ‘start’ the graph (basically disable anything in the ‘gather’ stage of your workflow), and run the graph. Quickly confirm that the many errors have produced a null result on EVERY node which interacts with Revit. Normally, this would be bad, but in this case… save the graph, reconnect the selection nodes, and save the graph again. The bindings should have been removed. Alternatively you can replace the nodes which create Revit content with new versions - copy/paste is your friend. This can be difficult as you may not know every node in your first pass. Both of these methods are more ‘user friendly’ to perform, as they keep you in the Dynamo user interface."

If I copy and paste the entire graph, as-is, off to the side, and then delete all the original nodes, does that do the same thing?

Then you said:
“2. Open the graph in a text editor, find the “Bindings” section, and remove all the content in the brackets.”

Which brackets the curly brackets or the square ones. Can you post a picture as an example please?

Check the link at the end of that post - there is an example on page 39 of the presentation.

Alternatively (and this will be the fastest way forward), post the dyn as noted before and I’ll have a look.

Hello @JacobeSmall, please see the link. Let me know if you cant download it. Thanks a million!

Edit:
Is this “Binding Be Gone.dyn” script work on Dynamo 1.3.4 or just Dynamo 2.1?

Let me look at this directly and get back to you.

That graph is for 2.0+.

Didn’t see you’d uploaded a new file, so it is possible that the updated dataset could address the issues in the first upload, but in reviewing your prior upload there is just too much going on for you to really be able to leverage this at any speed.

I advise revisiting your plan to reuse content (go to the well one time instead of repeatedly) reducing the scope to multiple runs (do thing A with this graph, thing B with another, thing C with another) is likely your best bet.

(edited as I did another query on the archive drive)
Even after removing a bunch of custom nodes to just open the file in the faster performing Dynamo 2.0 and removing any potential element binding by nuclear means, your graph has the 24th largest raw file size in 2.5 years of files on my system. Again that is with absolutely no bindings, and many removed nodes. The graphs which had a larger size created something like 1,000,000 brick instances (which means a lot of element binding in play) or had serialized geometry in it via the Remember node.

I suppose that opening your graph in a headless state (ie: Dynamo player) and letting an automation machine with infinite ram and a great processor could resolve that, but my laptop won’t handle it.

In a sentence, what is this graph’s purpose?

It is to collect all the layout point data (parameters), location, and organize the points via an X,Y location in a given building area, which is set up to clash with an mass in the model representing the area, then dump all of that into excel. then, on the subsequent runs, it verifies if there are any new points not yet in excel and does the same thing for them and adds them to the spreadsheet. this is necessary because we have multiple points scattered across multiple models. I am joining and numbering all of them via excels help. I have a second graph that reads from excel and writes to revit.

@jacob.small

Can you give me some pointers on how to do this? I do, on occasion, do the same command, like querry elements properties after I get them in a particular oder that I want, just because I find it to difficult to create multiple streams of organizing the content in the same way. is there a way to organize, @L3, or @L4 or even at @L5 lists by another list or even a flat list in some way? That way would probably be easier than what I am trying to do but I am having trouble with that…

I think when things really went haywire was when I got my elements in a particular L3 list and then I needed to querry all the subcomponents in that list. Is there a way to organize previously found sublists of subcomponents (in a sublist) with other elments (with no subcompents ie not in a sublist) with another list, of all the parent families? Basically I have some families that have subcomponents and some that do not. And I need a sublist for the families that have the subcomponents. And then I need all that grouped by a particular area it falls into. So +1 to the list level