What to do with big, long heavy dynamo scripts?

Hello there,
I’ve been using dynamo for quite a time and a few times I have reached the limit where the software started to act slow an buggy.
I’m thinking about situations when you are doing something really complex and have 200+ nodes. Suddenly basic nodes start to give you null as an output and you have to delete them and replace them with another instance of the same. The dynamo interface becomes really slow to pan and move.
Also when you reach this limit basic nodes start to give output really slow.

So the question is what to do in this situation? Is maybe creating custom nodes out of big chunks of the script helps? Or is the only way knowing the limit of the software and use multiple dynamo scripts?

I use a combination of turn nodes to code and seeing if I can separate the routine into several smaller routines and run them one after another.