The author creates local copies of references to functions they use often for a small performance improvement. Calling a function using a global reference is slightly slower than using a local reference.

The difference is very small, though. If you call a function a million times, you might see a millisecond difference or so. It can be worth considering for addons which do a lot of calculations in combat, like Omen.

The author creates local copies of references to functions they use often for a small performance improvement. Calling a function using a global reference is slightly slower than using a local reference.

The difference is very small, though. If you call a function a million times, you might see a millisecond difference or so. It can be worth considering for addons which do a lot of calculations in combat, like Omen.

Ty for the answer - so in fact if i was to rewrite his addon i could actually leave these kind of locals behind?

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?

And if you're looking for an easy, starter addon... it's NOT going to be a threat meter. Just FYI.

__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh