Event lag issue
Hey guys!
I'm somewhat new to addon creation, and I've encountered a little problem. I've reinstalled my windows and currently using default UI, but I've made myself a small unitframe, as the default playerframe is way to far from the actionbars, and as a fury warrior, I have to see my current rage almost every second.
The problem with it, is that I used OnEvent script with UNIT_POWER, and its kinda laggy.
The default playerframe shows my rage decrease as: 7 6 5 4 3 2 1 0.
With the OnEvent script my frame shows it as: ..(zZz)..7..(zZz)..5..(zZz)..3..(zZz)..1
In some cases it even stucks on 1 (when I have 0), until my rage changes again.
I was sure it's not about one more statusbar shown on screen, as it doesn't use as much resource to make it laggy. However, I tried this: I removed everything from the lua (well only made it a comment --[[ ), and what was remeaning is a frame, the OnEvent script, and the handler for it. The handler function printed my current rage to the chatframe, nothin else, and the result was the same: 7..5..3..1..
I've solved the problem by switching to OnUpdate on the frame, but I think it will use too much resource when I will make the whole raidframes with power and health bars.
The questions I'd like to be answered are: what causes the events to be laggy? How can it be solved?
If I use OnUpdate, will it use much more CPU when there will be raidframes using OnUpdate too (instead of OnEvent)?
|