I found some code that had \"optimization\" like this:
void somefunc(SomeStruct param){
float x = param.x; // param.x and x are both floats. supposedly this
When you specify a "simple" variable (not a struct/class) to be operated upon, the system only has to go to that place and fetch the data it wants.
But when you refer to a variable inside a struct or class, like A.B
, the system needs to calculate where B
is inside that area called A
(because there may be other variables declared before it), and that calculation takes a bit more than the the more plain access described above.