INADA Naoki <songofaca...@gmail.com> added the comment:

@Serhiy

php implemented similar idea recently.
https://react-etc.net/entry/improvements-to-garbage-collection-gc-php-7-3-boosts-performance-in-benchmark

In short, each tracked object have only "index" of GC struct, not "pointer".
GC struct is in array and it can be resized.

I tried to copy it, but there are some challenges:

* _PyObject_GC_TRACK() will resize GC array and cause MemoryError.  It's not 
API compatible.
* php's GC is not generational. This design may slow down moving objects 
between generation.
* We need one word (index) for object header and two words (refcnt, pointer to 
the object) for GC struct.  It means we can reduce memory footprint only for 
untracked dicts and tuples.

And this is my first time GC hack.  So I gave up PHP way and choose easier way.

Anyway, we have gc.freeze() now which can be used for avoid CoW after fork.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33597>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to