Jython, GILs and object locking.

Daniel Dittmar daniel.dittmar at sap.com
Thu Oct 16 04:56:58 EDT 2003


> Daniel Dittmar wrote:
>> Py_INCREF and Py_DECREF will have to use some kind of interlock to
>> synchronize reference counting, this will probably slow down things
>> a lot.
>
Harri Pesonen wrote:
> No, they don't have to be incremented or decremented at all, because
> the   reference count of static objects has no meaning at all, because

I meant dynamic objects. In the Python code
a = b
the count for b gets incremented and the count of the object a points to
gets decremented.

Reference counters are being changed almost everywhere in Python, when
tuples are created, when parameters are passed to a method etc. All this
will get slower because access to the counters has to be synchronized.

One could try to remove reference counting along with the GIL, but that has
other repercussions, some for extension writers, some for the language
CPython (Jython has already these problems).

Daniel







More information about the Python-list mailing list