08/30/15, 07:46 PM
|
#23
|
Join Date: Apr 2014
Posts: 129
|
Originally Posted by Sasky
What merlight is trying to say is that finding the square root is a computationally expensive operation and should be avoided if at all possible. If sqrt( A ) < sqrt( B ), then A < B for distances.
I'd look at what else you're doing in the function because local variables by themselves won't noticeably increase GC time ( http://lua-users.org/wiki/OptimisingGarbageCollection ). In fact, it's generally an optimization to copy over to local from a global table, especially if you're going to access it frequently. ( http://lua-users.org/wiki/OptimisingUsingLocalVariables)
For example, looking up "FyrMM.currentMap.TrueMapSize" actually needs 3 table lookups: FyrMM in the Global table, currentMap in FyrMM, and TrueMapSize in currentMap. Bringing it to a local variable caches it so that when you access it the second or third time it's already present.
|
I know ![Wink](//cdn-eso.mmoui.com/images/style_esoui/smilies/wink.gif) , I'm not new into LUA.
|
|
|