• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Which is slower, accessing global vars || another object's vars?

Assuming one had to repeatedly access/assign a variable that exists outside of the object doing the accessing/assigning,

Which would be slower; accessing/assigning a global variable or accessing/assigning another object's variable?
 
S

Shawn Shipton

Guest
I just tested this and global accessing / setting is about 3 times faster, Idk why though.
[tested with yyc]
I would assume that it is becuase the global variable exists in one location always, it is outside the scope and slower but still in one spot, where in the case of instance variable the code has to find the instance first then find the variable in the instance.
 
Top