[Python-3000] Delayed reference counting idea
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Tue Sep 19 18:55:26 CEST 2006
"Marcin 'Qrczak' Kowalczyk" <qrczak at knm.org.pl> writes:
> It involves operations every time an object is merely passed around,
> as references to the object are created or destroyed.
And it does something when it frees an object. In some GCs there is
a cost associated with keeping an object alive, but there is no
per-object cost when a group of objects die.
Most objects die young. This is what I've measured myself. When my
compiler runs, the average lifetime of an object is about 1/5 GCs.
This means that 80% of objects have only an allocation cost, while
freeing is free. And with a generational GC most of others are copied
only once: major GCs are less frequent than minor GCs.
It is true that a given long-living object has a larger cost, but such
objects are a minority, and I believe this scheme pays off. Especially
if it was implemented better than I did it; this is the only GC I've
implemented so far, I'm sure that experienced people can tune it better.
__("< Marcin Kowalczyk
\__/ qrczak at knm.org.pl
More information about the Python-3000