Quote:
Every single place where an object is referenced, and every single place where a reference is dropped, must properly alter the refcount of the objects being manipulated. One mistake and an object (and everything it references, directly or indirectly) lives forever or dies prematurely. Since a lot of code references objects, that's a lot of places to scatter reference counting code.
I'm not even sure what this means. You write a wrapper once and forget about it.
Quote:
The cost of a reference counting scheme is directly linked to the number of times code references, or unreferences, objects.
The cost involves a single pointer dereference and increment/decrement. Considering that languages like Python look up symbols in a dictionary every time they're referenced, this is minimal. It really boils down to your priorities. If you want to offload the cost to a single long running step, you use mark and sweep. If you like an incremental approach that scatters a minimal cost accross the whole application, you use reference counting.
Quote:
The data is also less dense, as there has to be a reference count embedded in it. Once again, that means more cache used for each object during normal running, and lower cache density.
Considering that modern operating systems run many processes at once, this hardly matters. The only time where this may make a difference is in very tight inner loops. These places require special handling anyway, people don't tend to write very tight loops in dynamic languages. Yet again, we're dealing with two assembly instructions here, hardly a strain on the cache.
Quote:Original post by WitchLord
By the way, do you think Python's way of doing it can be incremental? I think so, but I haven't had the time to analyze it sufficiently to prove it to myself.
Well, Python can't really afford to do it fully incrementally because if they checked for cyclic references for all potential objects, 80% of the time will end up doing cyclic reference checks. In AS you'll know the exact set of objects you'll need to check (which in real applications will be minimal), which means you don't need to add them to the list and check later. You can just walk the graph immediately.