Deferred, coalescing, and other very recent reference counting optimization

In CPython we have reference counting. My question is can we optimize current RC using strategies like Deferred RC and Coalescing? If no then where would I face problem if I try to implement these sorts of strategies? These strategies all depend on the concept that we don't need the exact value of reference count all the time. So far in my observation, we only need exact value before running a cycle collector. If we can manage to make sure that we have exact value before entering the cycle collector then in my opinion we can add these optimizations strategies to some extent. Is there something that I am missing? Or It is quite possible? If not possible please tell me the factors I should consider. Thanks in advance.

Python's cyclic GC collector uses exact reference count. See https://devguide.python.org/garbage_collector/ for detail. On Mon, Aug 24, 2020 at 12:29 AM Raihan Rasheed Apurbo <apurbo97@gmail.com> wrote:
-- Inada Naoki <songofacandy@gmail.com>

I know that.... but do we need exact reference counting in any other case? what if we find out exact value just before entering GC and rest of the time use deferred value so that we can get rid of some addition subtraction operation during normal byte code execution. Is this possible? If not why so?

On 8/24/2020 12:15 PM, Raihan Rasheed Apurbo wrote:
I know that.... but do we need exact reference counting in any other case? what if we find out exact value just before entering GC and rest of the time use deferred value so that we can get rid of some addition subtraction operation during normal byte code execution. Is this possible? If not why so?
There are string optimizations that check if the reference count is exactly one. One such optimization is +=. See https://github.com/python/cpython/blob/master/Objects/unicodeobject.c#L2005 for the test. Eric

where will I find these experiments and results? can you show me where to look for? thanks in advance :D

Python's cyclic GC collector uses exact reference count. See https://devguide.python.org/garbage_collector/ for detail. On Mon, Aug 24, 2020 at 12:29 AM Raihan Rasheed Apurbo <apurbo97@gmail.com> wrote:
-- Inada Naoki <songofacandy@gmail.com>

I know that.... but do we need exact reference counting in any other case? what if we find out exact value just before entering GC and rest of the time use deferred value so that we can get rid of some addition subtraction operation during normal byte code execution. Is this possible? If not why so?

On 8/24/2020 12:15 PM, Raihan Rasheed Apurbo wrote:
I know that.... but do we need exact reference counting in any other case? what if we find out exact value just before entering GC and rest of the time use deferred value so that we can get rid of some addition subtraction operation during normal byte code execution. Is this possible? If not why so?
There are string optimizations that check if the reference count is exactly one. One such optimization is +=. See https://github.com/python/cpython/blob/master/Objects/unicodeobject.c#L2005 for the test. Eric

where will I find these experiments and results? can you show me where to look for? thanks in advance :D
participants (4)
-
Eric V. Smith
-
Greg Ewing
-
Inada Naoki
-
Raihan Rasheed Apurbo