A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-April/044344.html below:

[Python-Dev] Optimization targets - refcount

[Python-Dev] Optimization targets - refcount [Python-Dev] Optimization targets - refcountJeff Epler jepler at unpythonic.net
Fri Apr 16 15:06:22 EDT 2004
Maybe something like this:

#ifdef __GCC__
#define constant_p(x) __builtin_constant_p(x)
#else
#define constant_p(x) 0
#endif

#define Py_INCREF(x) \
    if( ! constant_p(x) || (x != Py_None && x != other immortals)) \
        actual Py_INCREF body(x)

this should allow the compiler, by constant propagation, to skip actual
Py_INCREF body when it sees
    Py_INCREF(Py_None)
and when it's
    Py_INCREF(nonconstant)
to have no test for equality with the immortal values.

does this actually work?  I didn't check.  I think that on some
important systems there may be no equivalent to gcc's
__builtin_constant_p(), and that Py_None is not a compile-time constant
(*cough* DLLs *cough*)

Jeff

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4