I work in civil3d, not revit (its also marked with civil3D). I already filtered it down to two lists of objects but I don’t know if I can make it any faster, because its quite annoying to wait for 2 hours or more.
What you can/cannot do to speed things up will depend on what your script is actually doing. Have a look at the package called TuneUp, so you can concentrate on the areas of higher times to refine them.
If using geometry make sure you do this as late as possible in your script, and do not continue passing it along when not needed
Utilise Python instead of OOTB nodes may gain some time savings and of course dispose of everything when not needed.
The tuneup package will let you know where the file is slow, as each node’s execution time will be identified. This way you won’t spend six hours addressing something which can only make you 3 seconds faster, but instead focus on the area which can have impact.
My guess is that there is some manor of cross product lacing at play on the 200 solids, creating 200*28 solids to deal with when in memory, resulting in a lack of RAM for the process.
Maybe it has something to do with the bindings in the saved script. We always clear this part of the script after saving it, as otherwise some scripts take way longer without this step. For this task I created two co-op scripts as powershell and batch:
If you want to try it first: Just open the .dyn file in editor and search for “bindings”. Everything between the following pair of brackets “[…]” has to be deletet: ‘[ ]’. Then save the .dyn file.