About add-ons optimization
View Single Post
08-23-13, 09:39 PM
A Pyroguard Emberseer
Join Date: Jul 2006
That's actually more specific of a situation, as your definition of
is needed in all iterations in the for loop, it's best to keep it where it is instead of reinitializing the same value to the same local multiple times. This can impact performance to do so unnecessarily.
As a rule of thumb, if a variable is needed in all iterations of a loop instead of in each independent iteration, it's best to define it as an upvalue instead of inside the loop.
As far as using
versus manually indexing tables, it depends on how you're indexing the table for each return and at some point, I would think
would start to be more appealing, but no data exists to suggest at what point (if any) this will start to happen.
It can be guessed at that indexing the table will happen in C side when dealing with
, but another question is how would it compare to manual indexing in a single assignment statement? To make the comparison fair, the manual indexing will need to be a single-dimensional table. For example,
will use 4 indexing operations for a single value when storing the specific table into a local, then indexing it in your function call will result in only 1 index operation per value.
local points=ns.colors.cpoints[i]; cPoint:SetTexture(points, points, points);
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
Last edited by SDPhantom : 08-23-13 at
View Public Profile
Send a private message to SDPhantom
Visit SDPhantom's homepage!
Find More Posts by SDPhantom