Message260101
Py_SETREF() is used not only for fixing possible bugs. It can make the correct code shorter and cleaner. For example Stephan appreciated this in df78978dacab. In most case the difference between Py_DECREF and Py_XDECREF looks negligible.
Most of the SETREFs in the next() functions in the itertools module replace Py_CLEAR and therefore don't add additional overhead (but may fix possible bugs). The only Py_DECREF were replaced in tee_next() and accumulate_next(). But they are used not in tight loop. Py_SETREF in tee_next() is executed only for every 57th call. It unlikely causes any measurable degradation. Py_SETREF in accumulate_next() is used together with calling PyIter_Next and PyNumber_Add() or PyObject_CallFunctionObjArgs() which takes much more time.
In any case it would be nice to see any measurements that show a degradation. |
|
Date |
User |
Action |
Args |
2016-02-11 12:25:19 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, vstinner, python-dev |
2016-02-11 12:25:19 | serhiy.storchaka | set | messageid: <1455193519.25.0.132541521943.issue26200@psf.upfronthosting.co.za> |
2016-02-11 12:25:19 | serhiy.storchaka | link | issue26200 messages |
2016-02-11 12:25:18 | serhiy.storchaka | create | |
|