[Python-Dev] Removing the GIL (Me, not you!)

André Malo nd at perlig.de
Thu Sep 13 12:19:21 CEST 2007


* Christian Heimes wrote: 

> Pardon my ignorance but why does Python do reference counting for truly
> global and static objects like None, True, False, small and cached
> integers, sys and other builtins? If I understand it correctly these
> objects are never garbaged collected (at least they shouldn't) until the
> interpreter exits. Wouldn't it decrease the overhead and increase speed
> when Py_INCREF and Py_DECREF are NOOPs for static and immutable objects?

The check what kind of object you have takes time, too. Right now, just 
counting up or down is most likely faster than that check on every refcount 
operation.

nd


More information about the Python-Dev mailing list