How much does a reference/pointer to an object cost in t开发者_Python百科erms of memory and performance in Actionscript 3? Are weak references( using Dictionary object) less, the same or more overhead?
References are nothing more than the address to an object that is located on the heap. I guess it depends on the address range as to how many byte/s are needed. In anycase, it is going to be really really small, either a dword for 32bit machines or a qword for 64bit. You might as well think of them as insignificant and don't worry at all about how much space they take up.
With performance, the only thing you need to worry about is when you access a static variable in another class, there are some extra lookups required which slows performance a little (but a static variable in the same class as where you are calling is the same - from what I have read).
My educated guess is that weak references are the same regarding overhead, and even if they were not, it would be a microscopic difference.
If you are interested in reading more about the dark depths of the AVM2 then this is a pretty good read http://learn.adobe.com/wiki/display/AVM2/1.+Introduction
Hope that helps
精彩评论