gh-110481: Implement _Py_DECREF_NO_DEALLOC for free-threaded build by corona10 · Pull Request #111560 · python/cpython

I'm not sure this change will actually improve performance. In the default build, _Py_DECREF_NO_DEALLOC can avoid a > comparison and avoids emitting a function call. With Py_NOGIL, we still need the comparison and call to > _Py_MergeZeroLocalRefcount.

In the end, I think the Py_NOGIL version of _Py_DECREF_NO_DEALLOC may look exactly like Py_DECREF.

I totally agree. If we consider edge cases of _Py_DECREF_NO_DEALLOC, it will be similar to Py_DECREF of Py_NOGIL version.

I close the PR, and if there is a way to improve the performance, I will re-investigate it.
Thank you!