[Guido van Rossum] > > Py_INCREF(Py_True); > > return Py_True; > > > > takes less time than > > > > return PyBool_FromLong(1); > > > > Maybe a pair of macros Py_return_True and Py_return_False would make > > sense? [Armin Rigo] > Sorry if this was already suggested and hastily rejected, but why do we > care > at all about the reference counter of the few heavily-used immortal > objects of > CPython? > > I guess allowing their counter not to be carefully maintained ventures to > the > slippery slopes of bad code. Anyway, my two cents for a (very) slightly > faster and shorter code would be to be allowed never to do Py_INCREF or > Py_DECREF when we know that the object is Py_None, Py_False or Py_True. > These > three would have a dummy tp_dealloc that just resets the reference counter > to > some large value if it ever reaches zero. Hmm, how about having the macros do the increments while in the debug but skip them for production code. That would keep the quality controls in, not break existing leak detection methods, and save the microseconds for incrementing. Raymond
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