Closed Adolio closed 1 year ago
Since code worth hundred of words, here is an early change proposal: https://github.com/Adolio/Starling-Framework/tree/juggler-memory-imp (to be tested..) 🙂
Hey Aurélien!
As far as I remember, there's no specific reason I used the Dictionary in that case – probably I thought it would just be the most efficient way to do it, but that's definitely not the case if AIR is allocating a String for each of those operations. 😱
So your way of doing it is definitely preferable. I can't think of any downsides!
Could you maybe turn this into a pull request? Then I'll happily merge that change into the master branch.
Thanks a lot for making me aware of this! 👍
Thanks for your answer Daniel :)
Here is the PR: https://github.com/Gamua/Starling-Framework/pull/1099
Happy review!
Thanks a lot for the pull request! In the meantime, it has been merged – so I think we can close this issue! 😄 Thanks again!
Hey Daniel,
While doing few optimizations by tracking down all possible allocations in my game, I noticed that the
Juggler
class is actually allocating quite a lot ofString
in my case.Apparently, AIR is automatically calling the
toString()
method of an object when it used as a key in aDictionary
: https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/Dictionary.htmlFrom Scout:
Line in question in the
Juggler
class:@PrimaryFeather Do you remember if this dictionary optimization was important the framework or if I could somehow change the code to simply browse the list instead of having the object being indexed?
My goal here is to have more control over the allocations but more importantly for the performance drops related to the garbage collector "passage" 😉
Thanks in advance for your help!
Best, Aurélien