Thread Tools Display Modes
09-29-13, 04:41 AM   #1
Lolaan
A Murloc Raider
Join Date: Nov 2012
Posts: 9
Performance enhancing ideas

Due to how lua works, local calls are faster than global calls (there's an extra step in accessing a global vs a local). I notice that you don't have local calls for global functions defined in Carbonite. what I mean is something like this:

Code:
local ipairs = ipairs
local pairs = pairs
local select = select
local strfind = string.find
local tinsert = table.insert
local tsort = table.sort
local wipe = table.wipe
local GetTime = GetTime
local UnitAura = UnitAura
From the little bit of testing I did, these local calls do seem to be slightly faster (1-5%ish) and given how CPU heavy Carbonite already is, every little bit helps. This should be a fairly easy change as except for calls that have special characters (such as the . in table.sort or string.find) in them you can name the local copy the same as the global version.


The other thing I've seen work in other addon (namely Ovale, who's author I've been talking with a lot) is caching values as much as possible. As an example:

Storing attackPower and only updating it on the UNIT_ATTACK_POWER event vs always calling it from the API gives significant savings.

Calling it direct from Bliz's API costs almost twice as much CPU time as calling it from a public-static variable. Though this may be far less relevant for Carbonite as it is for Ovale.

For all I know you may already be doing this as the code is a bit hard for me to parse through (fairly novice programmer) but I figured I'd mention it anyhow.
 
 

WoWInterface » Featured Projects » Carbonite » Carbonite Archive » Performance enhancing ideas

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off