SakeTami
WeakAuras
WeakAuras

patreon


Event handling optimization

Hi, Buds here to describe a optimization in the event handling for the next release.

How events from triggers are handled in WeakAuras

In WeakAuras, Triggers (generic or custom) are functions that are executed after an event is executed.
Each trigger has to register a list of events it listens to, this is  centralized in a single event dispatcher in charge of calling all  trigger functions. 

What was the problem?

While investigating a performance issue only happening while in a raid  group, the profiling function showed that the trigger "Action Usable"  was consuming 85% of its (not global) CPU time on the event  "UNIT_POWER_FREQUENT".
This trigger is pretty simple, but the way the event was handled didn't  scale very well with group size, it was called for each unit that was  gaining or losing power instead of just the player. 

Until now, all events were registered with the function RegisterEvent which doesn't filter by unit, so this had to change.

RegisterUnitEvent to the rescue!

Starting with WeakAuras 2.12.4-beta3 or newer, generic triggers now use RegisterUnitEvent for UNIT_* events with a valid UnitId instead.
This will drastically improve performance of "Power", "Health", "Cast",  "Action Usable" and other triggers relying on UNIT_* events.

If you write custom code, custom triggers also benefit from this and  the "Event(s)" field has been extended to support unit filters. E.g.:

COMBAT_LOG_EVENT_UNFILTERED Sub-Event Filters

The "Combat Log" generic trigger already supported sub event filtering  at the dispatcher level but we also added that functionnality for custom  triggers that are using COMBAT_LOG_EVENT_UNFILTERED. E.g.;

In addition, you can now also use the "CLEU" shorthand instead of "COMBAT_LOG_EVENT_UNFILTERED" in the "Events(s)" field.

In conclusion, over time WeakAuras has grown a lot and is now a major  tool for many World of Warcraft players, we deeply care about  performance and will continue to improve it over time. 


More Creators