WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Which would be more efficient? (https://www.wowinterface.com/forums/showthread.php?t=55901)

Layback_ 12-05-17 09:21 PM

Which would be more efficient?
 
Hi all,

Since outlaw rogue got buffed, I'm trying to continue on with one of my abandoned project which tracks 'Roll the Dice'.

The current version has one parent frame with six cooldown objects as children and the parent frame is the only object registered with "UNIT_AURA" event.
(It does nothing but handling "UNIT_AURA" event + being a draggable object)

My question is would it be more efficient keeping this approach? or should I register "UNIT_AURA" event for each child object?

Thank you!

Fizzlemizz 12-05-17 09:55 PM

One frame receiving/processing the event each time or 6 frames receiving/processing the event each time, I would stick with the first one. At the very least it saves the game having to track frames and send out the extra 5 events.

vis781 12-06-17 11:37 AM

In terms of performance, you wouldn't notice the difference. We would be talking ticks in execution time. Bliz code will be using some kind of delegate under the surface that statically links the functions at compile time. They will all need to be executed on by one, so not much difference.

Which ever one you fancy the most I would say, but on the other hand... needlessly creating frames isn't the best idea.

Layback_ 12-06-17 07:18 PM

Thank you for your opinions, Fizzlemizz and vis781.

Guess I should stick with the original one :)

Resike 12-08-17 03:10 AM

I've actually tested this, not with buff or cooldown objects, but raid frames, and i found out there is no considerable amount of usage difference between the two methods.

The only difference is that if you gonna call multiple functions one time per update, or one function multiple times.

aallkkaa 12-08-17 09:34 AM

Quote:

Originally Posted by Resike (Post 326061)
The only difference is that if you gonna call multiple functions one time per update, or one function multiple times.

Small thread-hijacking:
But wouldn't A) call one function per event + do multiple if-then clauses for the child frames be faster than B) calling multiple (child frame) functions per event?

vis781 12-08-17 11:29 AM

The answer is maybe... Depending on the compiler. However the difference would be

Mov eax, some value
Cmp eax, someother value
Jne

3 ticks. But then the compiler may create a jump table so it could be faster. All in all, not worth worrying about.


All times are GMT -6. The time now is 05:06 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI