I have grasshopper definition with a large python component inside. Every time I run the script, the execution becomes slower. The slowing down seems to be fairly linear - see graph below.
After a Rhino restart everything is ‘fast’ again. I monitored the CPU usage of each run, but could not detect significant differences between them. I have this problem both with single- and multithreaded versions of my code.
Many things can cause this. A simple motivation might be that there’s some additional work to do at each iteration.
If not, it might also the the IronPython engine. It does not, generally, like nested functions and nested classes, especially if they capture variables / with “closures”. That being said, in this case it would be an IronPython issue. You should try to understand where in the code that happens, because this is mostly speculation.
We saw the exact same behavior of execution time increasing with each execution. In our python block the culprit was an isinstance() function calling what I assume is some IronPython funkiness:
from collections import Iterable
# Problem code
if isinstance(input_var, Iterable):
...
I suggest checking isinstance() calls, especially those involving the IronPython standard library.
Hi, I also tried using type(x) before the hacky isList() solution. I have no collections.OrderedDict in my code, but thanks for the suggestion nevertheless:)