Any recommendations to optimize this long-running script?

First post here. I have written a working script that injects data from excel into a set of families by matching a key parameter between the data row and the family type name.

Again, the script works but with a data set of almost 2,000 placed instances, IT IS SLOWWWW!

I have added some basic debugging by having the script write some data at key points to an external text file and the script execution time to the last file.write is less than 5 minutes. At that point, all the data should be in Revit so I am not clear why it would take over 24 hours for the model to update and the script to complete it’s run after this point.

My gut tells me that it is revit that is slow and not dynamo. I have tested this on several different machines and it does seem to complete faster on newer machines.

Full disclosure, this script is developed on a surface pro 3 with 8gb RAM against revit 2015 (yes, on purpose and it is a requirement at this point - there are plans to move to 2018/19 in a few months).

Any one else have a similar experience that can offer some insight?

As a first guess, I would say that the Excel and dictionary lookup ? part might be slow

Note- your screenshot is not legible (need to zoom in so all the text appears) I’m assuming the blue group is a dictionary ?

You might be better off using a database and a query instead


We need a screenshot that is legible, but I would say that you could call some of these functions inline to reduce the amount of RAM required. Also pulling the elements by another method might make it a bit more efficient.

Post the dyn, xls, and rvt and I’ll try and look into this on my lunch tomorrow. I do enjoy a good optimization effort. :slight_smile: