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