Hello,
On Mon, 1 Apr 2013 01:14:11 +0200
Alfredo Solano Martínez <asolano at icai.es> wrote:
>> The logic would then be something like this:
> - when increasing the refcount, a thread writes only to its own subcounter,
> creating one first if necessary.
> - similarly, when decreasing the refcount, there is no need to access other
> subcounters until that subcounter reaches zero.
> - when a subcounter gets to zero, delete it, and read the other subcounters
> to check if it was the last one.
But then you will decrement another subcounter, right? Meaning you need
a lock around all increments / decrements.
> Unfortunately, in a crude test of mine there is already a severe performance
> degradation, and that is without rwlocks.
Yes, there will be. Given how often INCREF and DECREF are called, any
complication of their implementation will significantly decrease
single-threaded performance.
See also
http://mail.python.org/pipermail/python-ideas/2009-November/006599.html
Regards
Antoine.