Jython, GILs and object locking.

Harri Pesonen fuerte at sci.fi
Thu Oct 16 01:55:41 EDT 2003


Daniel Dittmar wrote:

> Harri Pesonen wrote:
> 
>> It will be faster because there is no need to Py_INCREF(Py_None) or 
>> Py_DECREF(Py_None) or other static variables, and because there is no 
>> GIL or thread state swapping, but it will be slower because there will 
>> be an extra state argument in function calls. I guess the speed will 
>> be about the same for single-threaded programs. The real advantage 
>> comes of course from free-threading.
> 
> 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.

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 
static objects have no deallocator and they will never be freed. There 
is no synchronized access to these, it will just get faster.

Harri





More information about the Python-list mailing list