View Single Post
03-25-13, 02:07 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You could, yes, but as Haleth pointed out, the difference in speed is meaningful for an addon like Omen that's doing a lot of work in combat. Think about how many threat updates happen in a 25-player raid vs. a boss. Every HoT and DoT tick changes threat, as does every spell cast, every ability used, etc. Now think about a typical player running Omen, Recount, DBM, and Healbot -- how many functions are being called every second? Every bit of speed counts in keeping the whole UI running smoothly in raid combat.

There's absolutely no downside to upvaluing global functions you're going to be calling a lot (to "upvalue" something means to make a local pointer to something in a higher scope -- in this case, taking a function in the global scope, and making a pointer local to the scope of your file) and there is a tangible upside, so why not do it?
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote