I am working on a script that emulates the smoothing groups of Max inside Maya. It works fine till now (as much as its done yet) but it progressively slows down as I keep clicking the buttons on the user interface I made.
Each numbered button triggers a function, and earlier I thought there may be some bottlenecks in that function, so I assigned “print” commands as milestones at various points in it. But I found that all the delay happened even before the print at the top of the function statement executed.
So the delay happens before the function even starts being executed, and keeps increasing on each execution.
-
Can it be because of the large no of variables I declare inside the function. Is there any way to delete the unused variables at the end of the function so they dont take up memory. Though I am clearing the arrays at the end already, with the clear command.
-
Additionally an old scriptjob is killed and a new one is created everytime the function runs. Can this be leading to the delay?