[issue39543] Py_DECREF(): use inlined _Py_Dealloc()

2020-02-05 Thread STINNER Victor
STINNER Victor added the comment: New changeset f16433a73138f279642e581074135694ddcfe965 by Victor Stinner in branch 'master': bpo-39543: Remove unused _Py_Dealloc() macro (GH-18361) https://github.com/python/cpython/commit/f16433a73138f279642e581074135694ddcfe965 --

[issue39543] Py_DECREF(): use inlined _Py_Dealloc()

2020-02-05 Thread STINNER Victor
STINNER Victor added the comment: I wrote a quick & dirty local patch to define again _Py_NewReference() and _Py_Dealloc() as inline function in object.h before Py_DECREF(). I failed to see a clear win in term of performance. Microbenchmark: ./python -m pyperf timeit --duplicate=4096

[issue39543] Py_DECREF(): use inlined _Py_Dealloc()

2020-02-05 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +17736 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18361 ___ Python tracker ___

[issue39543] Py_DECREF(): use inlined _Py_Dealloc()

2020-02-04 Thread STINNER Victor
STINNER Victor added the comment: To declare _Py_Dealloc() as a static inline function in Include/object.h, we need to define the PyTypeObject in object.h which requires tons on other type definitions: PyNumberMethods, PySequenceMethods, etc. If possible, I would prefer to not move back

[issue39543] Py_DECREF(): use inlined _Py_Dealloc()

2020-02-04 Thread STINNER Victor
STINNER Victor added the comment: For _Py_NewReference(), I proposed PR 18346 to make it opaque (hide implementation details). -- ___ Python tracker ___

[issue39543] Py_DECREF(): use inlined _Py_Dealloc()

2020-02-04 Thread STINNER Victor
STINNER Victor added the comment: There are different problems. _Py_Dealloc() calls _Py_ForgetReference() and requires access to PyTypeObjects structure fields to call Py_TYPE(op)->tp_dealloc(). _Py_ForgetReference() is a function and so has no issuse with the limited API (it's not a macro

[issue39543] Py_DECREF(): use inlined _Py_Dealloc()

2020-02-03 Thread STINNER Victor
New submission from STINNER Victor : In bpo-35059, I converted Py_DECREF() macro to a static inline function (commit 2aaf0c12041bcaadd7f2cc5a54450eefd7a6ff12). Then in bpo-35134, I moved _Py_Dealloc() macro to the newly created Include/cpython/object.h header file (commit