Mads writing over at hagbarth.net
One of the (many) things that can slow down Nuke scripts is a extensive use of Roto brushes.
Nuke does not do any smart cleanup of brushes after you lay them out, and that sadly leads to a ton a redundant roto points, that does nothing but take up space and make your script slower to process and autosave.
I have always said that the RotoPaint node is very slow. I generally keep all
RotoPaint nodes to 100 strokes or less. After 100 it really doesn't matter how much python you throw at it. Mads thanks for pointing out this script on GitHub it should be useful to some TD's that are building there own paint tools.
Just as a side note. Please, please don't hand animate your paint strokes. Use a tracker. Mads has some great tools for doing tracking for beauty work. Mocha and other Nuke tools will do a better job and it will be faster.