It might be nice to find some in-depth discussion on common performance mistakes, especially issues that might be stylistic and pervasive throughout an entire project. I’ve heard horror stories of code packed with reflections that sap CPU time. … Unfortunately I don’t even understand the significance of that cautionary tale.
Here’s an example of an issue that concerns me at the moment. I often find myself needing to pass a lot of variables to a method - often a method in another class. Would I be better off to:
1)Use global variables instead (Nevermind the organization issue for the sake of argument)
2)Pass all variables of various types and not worry about it - this is the fastest way?
3)Keep Variables in a Dictionary instead and pass only the one Dictionary reference
4)In the case of a method from another class: simply pass this (similar to the global option I assume)
Going into more detail about #4, if I were to then use it’s variables many times e.g., that.x that.y that.z is there a performance penalty that I’m not aware of with each of these calls? Would I be better off to put them in a local variable and use that, or is that a wasted line?
This is the kind of stuff that keeps me up at night. If you are like me, maybe we could compile some interesting reading.