On 2019-06-06, Tim Peters wrote: > The doubly linked lists in gc primarily support efficient > _partitioning_ of objects for gc's purposes (a union of disjoint sets, > with constant-time moving of an object from one set to another, and > constant-time union of disjoint sets). "All objects" is almost never > interesting to it (it is only when the oldest non-frozen generation is > being collected).
My current idea is to put partitioning flags on the interior radix tree nodes. If you mark an object as "finalizer reachable", for example, it would mark all the nodes on the path from the root with that flag. Then, when you want to iterate over all the GC objects with a flag, you can avoid uninteresting branches of the tree. For generations, maybe tracking them at the pool level is good enough. Interior nodes can track generations too (i.e. the youngest generation contained under them). My gut feeling is that the prev/next pointer updates done by move_unreachable() and similar functions must be quite expensive. Doing the traversal with an explicit stack is a lot less elegant but I think it should be faster. At least, when you are dealing with a big set of GC objects that don't fit in the CPU cache. Regards, Neil _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/J422RWENKJAYHMXSZVRV5KGWSHNMAMJF/