Quantcast WoWInterface - View Single Post - Minimap Coordinates Memory Usage Optimization
View Single Post
07-10-19, 08:56 PM   #8
A Cobalt Mageweaver
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 212
Originally Posted by SDPhantom View Post
Moving local references to globals into a table defeats the purpose of making them in the first place, which is to save on indexing operations. You run the same number of these operations pulling them from your table as you would calling them as globals.
Think there was a misunderstanding, it's not an upvalue but rather the global itself. If you wanna get super technical it would be the same as sometable.UnitPosition = _G["UnitPosition"].

And to my knowledge a table lookup inside a function from a passed variable(self or vararg) is faster than calling a variable from outside of scope. In the cases where you're dealing with a single frame it takes up the same amount of space and is only slightly faster; if you were using OnUpdate on something like hundreds/thousands of frames it would be a trade off between CPU vs RAM depending on the number/type of things added to, or used from, the table. Sadly I'm used to doing it this way and it's certainly a bad habit.

Originally Posted by SDPhantom View Post
All literal values are constants referred to when used in an expression.
I don't always remember things correctly and again shoving everything into the table is a bad habit.

Originally Posted by SDPhantom View Post
This way of swapping OnUpdate scripts doesn't work at all.
Thanks for pointing that out, that was my bad and I have no excuse. I have absolutely no idea why I thought that would work. I corrected my post and will correct it further.
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison
  Reply With Quote