Thread Tools Display Modes
09/02/15, 11:12 AM   #21
Wandamey
Guest
Posts: n/a
i'm not sure of the protocole here... do I have to sacrifice a Virgin or something to have my questions looked at?
I'm starting to feel a little butthurt tbh.

yeah top post of a second page. ok. nvm. forget it.
  Reply With Quote
09/02/15, 12:00 PM   #22
QuadroTony
Banned
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 828
/offtop


Originally Posted by Wandamey View Post
do I have to sacrifice a Virgin or something
Originally Posted by Wandamey

nothing that you can buy, i'm not your *****.
  Reply With Quote
09/02/15, 12:09 PM   #23
Wandamey
Guest
Posts: n/a
Originally Posted by votan View Post
Question:
What if like this:
Bad?
Lua Code:
  1. local function DoSomeWhat()
  2.         --Code
  3. end
  4.  
  5. --This is run often
  6. function SetupTexture(texture, width, height)
  7.     texture:SetHandler("OnMouseEnter", DoSomeWhat)
  8.     texture:SetDimensions(width, height)
  9. end


i suppose

Code:
onload : CreateControl + 
texture:SetHandler("OnMouseEnter", DoSomeWhat) -- we got that now i think


local function DoSomeWhat(addon.a,addon.b,addon.c...)
    use addon.a
    use addon.b
    if addon.c then  
       blabla
   else
      blob
   end
end

--This is run often
function SetupTexture(a, b, c)
     texture:SetDimensions(a, c)
     addon.a = a
     addon.b = f(b)
     addon.c = constant  -- whatever
end
would that be the expected solution?


i repeat my question about "removing" a Handler (seems we got 2 different answers with baertram, maybe it would be a good thing to clear it)

is niling a handler as bad as overwrite it?
  Reply With Quote
09/02/15, 12:12 PM   #24
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by Wandamey View Post
Edit: btw, how to "remove" a Handler? Setting it on nil will delete the previous "closure" too?
That's exactly how you do it. If there's no other reference to it, it'll be garbage collected eventually.
  Reply With Quote
09/02/15, 12:20 PM   #25
Wandamey
Guest
Posts: n/a
so basically, i could patch anything very easily if the same function is called all the programm long by doing this (or just tweak the function with conditions if this has to change):

Lua Code:
  1. if control:GetHandler("OnThisaction") == nil then  control:SetHandler("OnThisaction", definedfunction) end
?
  Reply With Quote
09/02/15, 12:32 PM   #26
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
You just need to avoid creating a thousand closures. Once you do that, you will notice that your code doesn't need to call SetHandler a thousand times, because all the calls would be identical. Aim for removing unnecessary closures. Set the handler once after constructing the control.

If you need something more complex, like switching an OnUpdate handler on when resizing and off when it's done, you naturally do have to call SetHandler multiple times, but chances are you don't need to create multiple closures.
  Reply With Quote
09/02/15, 12:50 PM   #27
Wandamey
Guest
Posts: n/a
Originally Posted by merlight View Post
You just need to avoid creating a thousand closures. Once you do that, you will notice that your code doesn't need to call SetHandler a thousand times, because all the calls would be identical. Aim for removing unnecessary closures. Set the handler once after constructing the control.

If you need something more complex, like switching an OnUpdate handler on when resizing and off when it's done, you naturally do have to call SetHandler multiple times, but chances are you don't need to create multiple closures.
thing is i get it overall, but when i look at my plugin for someone else's addon, there are a lot of things I can't control. But i'll figure out something. Just hoping it won't be worse after from another point of view than this particular problem.
  Reply With Quote
09/02/15, 02:49 PM   #28
Fyrakin
 
Fyrakin's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 129
OK, I just changed texture handlers in My add-on using pre-declared functions and setting handlers only when new controls are created. I expected to see much better results, though performance improvement is visible but not as I hoped .
  Reply With Quote
09/02/15, 04:24 PM   #29
Randactyl
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 251
My question is, what changed in the IC update that made this so much more of a problem than it was previously? Of course we should not be creating unnecessary closures, but it seems like the game is handling the issue with less grace than it should (or at least less than it was previously).
  Reply With Quote
09/02/15, 05:26 PM   #30
Wandamey
Guest
Posts: n/a
Originally Posted by Fyrakin View Post
OK, I just changed texture handlers in My add-on using pre-declared functions and setting handlers only when new controls are created. I expected to see much better results, though performance improvement is visible but not as I hoped .
wait, i'm almost done with mine... it'll make the tv shows pretending that it takes only one blondine to shut down the internet look ridiculous.

(yeah I feel guilty for last week-end now)

Last edited by Wandamey : 09/02/15 at 05:32 PM.
  Reply With Quote
09/03/15, 02:15 AM   #31
Fyrakin
 
Fyrakin's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 129
Originally Posted by Randactyl View Post
My question is, what changed in the IC update that made this so much more of a problem than it was previously? Of course we should not be creating unnecessary closures, but it seems like the game is handling the issue with less grace than it should (or at least less than it was previously).
Introduction of OnTextureLodead? I suspectį it also led to memory leak of sorts.
  Reply With Quote
09/03/15, 03:54 AM   #32
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,982
haha, I like "OnTextureLodead". This explains in short why the peaks happen
  Reply With Quote
09/03/15, 04:47 AM   #33
Fyrakin
 
Fyrakin's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 129
Originally Posted by Baertram View Post
haha, I like "OnTextureLodead". This explains in short why the peaks happen
I was starting to think no one will see that.
  Reply With Quote
09/03/15, 05:46 AM   #34
@AlphaLemming
 
@AlphaLemming's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 122
Is there any example for designing a UI with XML and using it in LUA with my Addon ?
I never was happy to create this all in LUA.
  Reply With Quote
09/03/15, 06:12 AM   #35
Fyrakin
 
Fyrakin's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 129
Originally Posted by @AlphaLemming View Post
Is there any example for designing a UI with XML and using it in LUA with my Addon ?
I never was happy to create this all in LUA.
I have some controls like buttons with handlers configured in XML, you can look at MiniMap.xml
  Reply With Quote
09/03/15, 07:44 AM   #36
@AlphaLemming
 
@AlphaLemming's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 122
Thanks, that will help. Is there a possibilty to use array names for XML elements?
  Reply With Quote
09/03/15, 07:46 AM   #37
ZOS_ChipHilseberg
ZOS Staff!
Premium Member
Yes this person is from ZeniMax!
Join Date: Oct 2014
Posts: 551
Originally Posted by Fyrakin View Post
Introduction of OnTextureLodead? I suspectį it also led to memory leak of sorts.
Internally we haven't experienced any noticable change in performance of the stock UI (which runs as an addon the same as the custom addons). So any information on what in particular is triggering the performance problems you are seeing is helpful. Why do you think OnTextureLoaded is involved?
  Reply With Quote
09/03/15, 09:50 AM   #38
Fyrakin
 
Fyrakin's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 129
Originally Posted by ZOS_ChipHilseberg View Post
Internally we haven't experienced any noticable change in performance of the stock UI (which runs as an addon the same as the custom addons). So any information on what in particular is triggering the performance problems you are seeing is helpful. Why do you think OnTextureLoaded is involved?
Because after update, while on PTS I was experiencing severe performance degrade compared to what was on-live. Its just my theory, suspicion, superstition, etc. Well, to be honest we have very limited profiling means/tools. Just a game client and strong will to do something. We have no luxury to monitor which process utilizes most resources so we have to do it on try and error basis. So, based on /script d(collectgarbage("count")) output I observed a very fast lua memory usage increase I was comparing it to how it ran on live and pts, these figures haven't changed.

So, as you suggested I changed sethandler setting during add-on init for most of the texture add-on would use (handlers mostly for tooltips). I even moved anonymous functions to predeclared ones. I didn't see any change in resource consumption and I haven't noticed any signifficant performance improvement. SO, what else you would suggest us to do? I as many others would like to have minimap functionality, but at current state it is to say the least is not usable.

Follow up.
I managed to address the performance issues. Even though I no longer use my own tables to store and manage custom pin data I still observed fast collectgarbage("count") build up.

Last edited by Fyrakin : 09/03/15 at 10:27 PM.
  Reply With Quote
09/03/15, 10:31 PM   #39
Fyrakin
 
Fyrakin's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 129
Originally Posted by Wandamey View Post


I hope you can make it 3 lines with pictures


the big picture i see here is : store your functions first. but how do i pass a variable to it without using an Anonymous func again to call it? -- maybe the table?
What about self.your variable?
  Reply With Quote
09/04/15, 01:02 AM   #40
Lodur
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 108
Originally Posted by Wandamey View Post
probably a stupid question but i suppose someone has to ask it...

what is a closure?

an example would be nice too.
A closure is a combination of context and code...
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » 2.1 and SetHandler


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