Thread Tools Display Modes
12-05-17, 09:21 PM   #1
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
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!

Last edited by Layback_ : 12-05-17 at 09:30 PM.
  Reply With Quote
12-05-17, 09:55 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
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.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 12-05-17 at 11:55 PM.
  Reply With Quote
12-06-17, 11:37 AM   #3
vis781
A Fallenroot Satyr
Join Date: Dec 2017
Posts: 27
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.
  Reply With Quote
12-06-17, 07:18 PM   #4
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Thank you for your opinions, Fizzlemizz and vis781.

Guess I should stick with the original one
  Reply With Quote
12-08-17, 03:10 AM   #5
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
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.
  Reply With Quote
12-08-17, 09:34 AM   #6
aallkkaa
A Warpwood Thunder Caller
 
aallkkaa's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2017
Posts: 98
Originally Posted by Resike View Post
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?
  Reply With Quote
12-08-17, 11:29 AM   #7
vis781
A Fallenroot Satyr
Join Date: Dec 2017
Posts: 27
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.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Which would be more efficient?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off