Hi,
In my game there are certain parts that needs to be global, like score or some methods that most objects need to interact with and I would like to go and make them global because they need to be. But I’ve heard and read that globals are slower and rule of thumb is to use local.
So how much slower are we talking about here? How I can measure the difference? Is it to the point to cover that if I design an architecture that I can pass around one local object for an easily accessible global method/variable?
I was reading about memory management in C++ and I’ve read that there is a different part of memory for static and global functions and variables so both local and global functions use different hashtables and since I believe our Lua code is translated into C++ in Corona labs servers then I think it will be generated into either Java or Obj-C, then I *think* the same concept applies to those languages as well.
So to sum it up, is it advisable to avoid global if we are calling it on every enterFrame event or it’s still advisable to steer off from them even if you are calling them here and there.
Thanks. [import]uid: 206803 topic_id: 36688 reply_id: 336688[/import]