View Single Post
04-30-18, 04:05 PM   #9
boomboo
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Nov 2009
Posts: 4
It's not especially surprising since UnitAura is implemented in C (I presume), and might have it's own caching or optimizations. Adding stuff on top of it in lua doesn't help.

The best way to work around it is to probably reverse the loops for 8.x ie. instead of doing:
Code:
for list_of_spells_I_care_about {
  for 1, N {
    name, ... = UnitAura(, i, )
    if(name == list_of_spells_I_care_about[i]) do_whatever()
  }
}
do:
Code:
local list_of_spells_I_care_about_lookup_table
for 1, N {
  name, ... = UnitAura(, i, )
  if(list_of_spells_I_care_about_lookup_table[name]) do_whatever()
}
This way you're kind of cheating, since list_of_spells_I_care_about_lookup_table is a static list with a lookup cost O(1). This might not always be possible, depending on the addon / implementation.

Last edited by boomboo : 04-30-18 at 04:12 PM.
  Reply With Quote