Python's garbage collection was Re: Python reliability

Mike Meyer mwm at mired.org
Mon Oct 10 16:29:21 EDT 2005


Tom Anderson <twic at urchin.earth.li> writes:
> Has anyone looked into using a real GC for python? I realise it would
> be a lot more complexity in the interpreter itself, but it would be
> faster, more reliable, and would reduce the complexity of extensions.
>
> Hmm. Maybe it wouldn't make extensions easier or more reliable. You'd
> still need some way of figuring out which variables in C-land held
> pointers to objects; if anything, that might be harder, unless you
> want to impose a horrendous JAI-like bondage-and-discipline interface.

Wouldn't necessarily be faster, either. I rewrote an program that
built a static data structure of a couple of hundred thousand objects
and then went traipsing through that while generating a few hundred
objects in a compiled language with a real garbage collector. The
resulting program ran about an order of magnitude slower than the
Python version.

Profiling revealed that it was spending 95% of it's time in the
garbage collector, marking and sweeping that large data structure.

There's lots of research on dealing with this problem, as my usage
pattern isn't unusual - just a little extreme. Unfortunately, none of
them were applicable to comiled code without a serious performance
impact on pretty much everything. Those could probably be used in
Python without a problem.

       <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list