Script Performance

I had a couple of mostly theoretical questions about the python scripting, but maybe it will help me write better code as well.

  1. Is there any performance hit at all for passing properties of various components to local variables for use in the script? Or, is it the complete opposite, since the script doesn’t have to go “looking” for the actual variable every time it is evaluated? Obviously using local variables makes the code much more readable, so I prefer that. Or is the difference so small that it doesn’t even matter?

  2. Again, is there much overhead in passing parameters to functions? What is a reasonable number of parameters? 5, 10, 20? I’m assuming that a lot of parameters means that the component class needs some restructuring, but from a performance standpoint does it even matter?

These are probably minor points and more out of curiousity, but as I get more into the java paint component scripting, I’d like to understand this thoroughly.

Bingo.

Nope.

You’re looking in the wrong place for performance questions. Things like this don’t appreciably affect performance. Performance problems typically come with slow things (IO especially, object allocation (creation), GUI drawing and data crunching to a lesser extent) done in repetition.

Thanks for the confirmation. I suspected as much, but I don’t know anything about the Python memory allocation or overhead. I have worked with architectures before where function parameters and locals made a huge difference, and just wanted to make sure I was free to write the code any way I wanted (meaning, easy to read and write).