[Python-Dev] Optimization targets - refcount
Guido van Rossum
guido at python.org
Fri Apr 16 10:58:17 EDT 2004
> I think the idea is more that you could skip the 'Py_INCREF(Py_None)',
> which is a fairly common prelude to 'return Py_None'. You'd set their
> refcounts to the maximum possible value, and the deallocation function
> would simply reset the refcount to maximum again.
>
> I'm not sure, however, that this would be common enough to be helpful. It
> seems to me Py_INCREF should effectively translate to only a single machine
> instruction or two. I mean, it's just incrementing an integer whose
> address is known at compile time.
I vaguely recall that this was proposed and perhaps even tried before,
and not found to make a difference.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list