[Python-Dev] iterzip()

Neil Schemenauer nas@python.ca
Wed, 1 May 2002 07:31:00 -0700


Guido van Rossum wrote:
> But this still takes time, and most tuples never make it into GC, so
> it's wasted time, isn't it?

I agree.  The idea I though of last night was to have the GC special
case certain objects.  It could know about tuples.  After collecting the
first generation any surviving tuples that don't refer to objects with
the GC flag could be untracked.  We might even generalize it by
untracking objects that don't have a tp_clear method and don't refer to
GC objects.

BTW, I also looked into the train algorithm last night.  It's cool
because it never examines the entire set of objects (unless they all
happen to be a big cyclic garbage struture).  Unfortunately I don't
think it can be adapted for Python.

> I'd put such code in tuplevisit (assuming it's safe to call GC_UnTrack
> there).

That would be slick.  I don't know if it's safe without looking at the
code but it could probably be made so.

  Neil