[Python-Dev] Garbage collector problem

Kevin Jacobs jacobs@penguin.theopalgroup.com
Sat, 29 Jun 2002 09:03:32 -0400 (EDT)

On Sat, 29 Jun 2002, Tim Peters wrote:
> Nice job, Kevin!  You learned a lot in a hurry here.  I'll try to fill in
> some blanks.

Thanks for the great sleuthing, Tim.  I missed a few critical details about
how the GC system was intended to work.  It was not initially clear that
most GC traversals were not recursive.  i.e., I had assumed that functions
like update_refs and subtract_refs did a DFS through all reachable
references, instead of a shallow 1-level search.  Of course, it all makes
much more sense now.

Here are the results of my test program (attached to the SF bug) with and
without your patch installed (2.3a0+ and 2.3a0-, respectively) and GC enabled:

        20000    40000    80000    160000   240000   320000   480000   640000
Ver.   -------- -------- -------- -------- -------- -------- -------- --------
1.5.2  316450/s 345590/s 349609/s 342895/s 351352/s 353734/s 345362/s 350978/s
2.0    183723/s 192671/s 174146/s 151661/s 154592/s 127181/s 114903/s  99469/s
2.2.1  228553/s 234018/s 197809/s 166019/s 171306/s 137840/s 122835/s 105785/s
2.3a0- 164968/s 111752/s  68220/s  38129/s  26098/s  19678/s  13488/s  10396/s
2.3a0+ 291286/s 287168/s 284857/s 233244/s 196731/s 170759/s 135541/s 129851/s

There is still room for improvement, but overall I'm happy with the
performance of 2.3a0+.

> > So, what do all of you GC gurus think?  Provided that my analysis
> > is sound, I can rapidly propose a patch to demonstrate this approach if
> > there is sufficient positive sentiment.
> Seeing a patch is the only way I'd understand your intent.  You can
> understand my intent by reading my patch <wink>.

When functioning correctly, the current garbage collector already does what
I was suggesting (in more generality, to boot).  No need for a patch.

Thanks again, Tim.  It was a lively chase through some of the strange and
twisted innards of my favorite language.

Off to write boring code again,

Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19         E-mail: jacobs@theopalgroup.com
Fax:   (216) 986-0714              WWW:    http://www.theopalgroup.com