Quantcast C_Map.GetPlayerMapPosition Memory Usage - Page 2 - WoWInterface
Thread Tools Display Modes
07-09-18, 01:53 AM   #21
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 893
This is curiosity, not a "gang-up".

Unless there is some significant optimisation (happy to be educated), even incremental GC will be called more often as there is more G being produced to C.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle and Move Pad Plus.

Last edited by Fizzlemizz : 07-09-18 at 01:59 AM.
  Reply With Quote
07-09-18, 03:12 PM   #22
dssd
A Fallenroot Satyr
Join Date: May 2016
Posts: 22
GC time is proportionate to the complexity of the garbage. These are incredibly simple tables.
  Reply With Quote
07-09-18, 06:49 PM   #23
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 893
Which begs the question, why use a table in a language that allows multiple returns?

I feel like I must be missing some simple point, which wouldn't be the first time .
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle and Move Pad Plus.
  Reply With Quote
07-09-18, 07:02 PM   #24
dssd
A Fallenroot Satyr
Join Date: May 2016
Posts: 22
I'd guess it's towards normalization of data. For instance, look at C_Map.GetMapLinksForMap, it returns the same 2D vector table but as a field of a subtable in a collection of tables. In that case, multiple returns don't help, but containing them in a table keeps the data consistent. Vector 2D is likely the most contentious given that it is just two fields, but it scales better the more fields the type contains.
  Reply With Quote
07-09-18, 09:01 PM   #25
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 893
I remain to be convinced that it's normalisation .
Code:
local left, right, top, bottom = C_Map.GetMapRectOnMap(childMapInfo.mapID, mapID)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle and Move Pad Plus.
  Reply With Quote
07-19-18, 05:43 AM   #26
Simca
An Aku'mai Servant
 
Simca's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2012
Posts: 33
This issue has come up a lot in #wowuidev over the last several months. There is a WoW UI dev in there who kindly answers most of our questions and takes note of issues.

A lot of different people have argued this point with him, and I think I can quickly summarize his two main arguments for those curious:
  • They've greatly improved garbage collection performance recently, and have monitored the performance involved in using tons of small, disposable tables under the new GC implementation. It is an incredibly small performance hit.
  • Tables help normalize UI implementation and are especially useful in cases where the number of returns is variable. The other thing seems to be preference. It seems like the UI devs prefer the syntax where you pull down a table of results and use the individual parts you need rather than doing 'local _, _, thingA, _, _, _, _, thingB = SomeRandomApi()'.

I'm just paraphrasing here, but this is what I recall. In any case, it seemed like an issue they were -not- willing to budge on. One person was very adamant that they should introduce a function to return this one argument he was interested in because he polled it very frequently and was now required to pull down a table (Spell name, maybe? I forget), and the UI dev was not willing to entertain the possibility of introducing specialized functions to bypass the table returns. He was fairly adamant that there would be a near zero performance impact due to the speed of simple table disposal.

The only annoying part here is that it is basically impossible for us to independently verify their claims because as noted in previous posts, you can't really perform a partial GC on demand and record cycles spent or reliably compare the results. The only ones who can really know the exact impact of these changes are Blizzard themselves.
__________________
Assistant admin for MMO-Champion
WoW database file expert - ask me anything
  Reply With Quote
07-19-18, 07:15 AM   #27
Kanegasi
A Cobalt Mageweaver
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 232
Originally Posted by Simca View Post
It seems like the UI devs prefer the syntax where you pull down a table of results and use the individual parts you need rather than doing 'local _, _, thingA, _, _, _, _, thingB = SomeRandomApi()'.
I can actually agree with this part. I have used a table to get function returns before, but it was a reusable table in a custom pool function. I have always not liked using an underscore as a universal dump variable. It has caused many minor issues over the course of addon development over the years. The wall of shame link in my signature exposes why itís an issue.

However, relying on supposed efficiency to excuse inefficiency isnít a great coding practice. Itís like tossing bottles at a campsite because the park youíre at has a world class janitor army. Thatís still littering.
  Reply With Quote
07-19-18, 11:44 AM   #28
JDoubleU00
A Rage Talon Dragon Guard
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 333
Originally Posted by Kanegasi View Post
However, relying on supposed efficiency to excuse inefficiency isnít a great coding practice. Itís like tossing bottles at a campsite because the park youíre at has a world class janitor army. Thatís still littering.
Great analogy!
__________________
Author of JWExpBar and JWRepBar.
  Reply With Quote
07-19-18, 12:16 PM   #29
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 893
Originally Posted by Simca View Post
[*]They've greatly improved garbage collection performance recently, and have monitored the performance involved in using tons of small, disposable tables under the new GC implementation. It is an incredibly small performance hit.
Did they define "tons" or give a timeframe in which "tons" were created/disposed? This is an API for public consumption and test lab or even Blizzard UI conditions rarely mimic all the real world uses.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle and Move Pad Plus.
  Reply With Quote
07-21-18, 05:18 AM   #30
Simca
An Aku'mai Servant
 
Simca's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2012
Posts: 33
I have IRC logs, so let me just paste the whole conversation - the one I was thinking of when I posted that above. TheDanW is the UI dev. This conversation occurred in December 2017, after BFA alpha was out but when addons were disabled so most of us were just watching the interface files for diffs in order to speculate on what changes needed to be made.

https://paste2.org/wZGNWyGv

There's at least a few more instances of this type of conversation, but I don't really want to dig up his entire post history for people to take apart outside context, just to post a bit so you can see Blizzard's reasoning on this. Also, he mentions in one other conversation that if people are interested, he could add support to a few frequently called functions so that somebody can pass their own table as an argument in order to be reused. Might be a decent thing for somebody to suggest for GetPlayerMapPosition, though I'm not sure how viable it is due to it being a mixin (Vector2D) return.

P.S. I realize "Dec 18 17:43:56 <Simca> all new API since WoD return tables, with a few exceptions" this is quite hyperbolic. There are certainly a large number of tables returned by API functions since WoD, but there are more than 'a few exceptions'. Not sure why I decided to say it like that in retrospect.

Edit: Also, he mentions elsewhere that the optimizations for the garbage collector he is talking about were changes that went Live with Patch 7.0.3.
__________________
Assistant admin for MMO-Champion
WoW database file expert - ask me anything

Last edited by Simca : 07-21-18 at 05:20 AM. Reason: Clarification
  Reply With Quote
07-21-18, 09:08 AM   #31
lightspark
A Frostmaul Preserver
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 297
Originally Posted by Simca View Post
Also, he mentions in one other conversation that if people are interested, he could add support to a few frequently called functions so that somebody can pass their own table as an argument in order to be reused. Might be a decent thing for somebody to suggest for GetPlayerMapPosition, though I'm not sure how viable it is due to it being a mixin (Vector2D) return.
We're in C++ land now, bois
__________________
  Reply With Quote
Yesterday, 10:02 PM   #32
kurapica.igas
A Warpwood Thunder Caller
Join Date: Aug 2011
Posts: 90
The blz just don't use it themselves. We only need x, y, and it throw us a table with tons of the methods, this is not all about the GC, the Mixin system fill those methods into a table with lots of the re-hash cost, and mostly we don't really use them.

Thanks to elcius, I don't need to deal with it.
  Reply With Quote

WoWInterface » PTR » PTR API and Graphics Changes » C_Map.GetPlayerMapPosition Memory Usage

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