This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
标题: Don't needlessly change refcounts of dummy objects for sets
类型: performance Stage:
Components: Interpreter Core Versions: Python 3.4
process
状态: closed Resolution: fixed
Dependencies: 后续:
分配给: 抄送列表: Mark.Shannon, pitrou, python-dev, rhettinger, tim.peters
优先级: normal 关键字: patch

Created on 2013-08-21 07:55 by rhettinger, last changed 2022-04-11 14:57 by admin. This issue is now closed.

文件
文件名 上传时间 Description 编辑
no_refcnt_dummy1.diff rhettinger, 2013-08-21 07:55 Use #ifdefs to remove dummy object refcount changes review
no_refcnt_dummy2.diff rhettinger, 2013-08-21 17:48 Version without #ifdef review
Messages (4)
msg195751 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) 日期: 2013-08-21 07:55
AFAICT, there is no reason for sets to incref and decref dummy objects.  The dummy object address is used as placeholders in the hash table but it is never accessed by set the logic.   As long the one reference is held at the time the dummy object is created, nothing further is served by the increfs and decrefs.

I can take them out entirely or use ifdefs to keep them for debug builds.

Does anyone know of any issues?
msg195753 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) 日期: 2013-08-21 08:14
I can't think of any counter-indication but I think we shouldn't distinguish between debug and non-debug mode. That way the debug hooks can check that the refcounting optimization is right.
msg195810 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) 日期: 2013-08-21 17:48
> I think we shouldn't distinguish between debug and non-debug mode.

That makes good sense.
Attaching a new patch without the #ifdefs.
msg195904 - (view) Author: Roundup Robot (python-dev) (Python triager) 日期: 2013-08-22 15:20
New changeset ac6dab1819c4 by Raymond Hettinger in branch 'default':
Issue 18797:  Remove unneeded refcount adjustments for dummy objects.
http://hg.python.org/cpython/rev/ac6dab1819c4
历史
日期 用户 动作 参数
2022-04-11 14:57:49admin修改github: 62997
2013-08-22 16:01:38rhettinger修改状态: open -> closed
resolution: fixed
2013-08-22 15:20:43python-dev修改抄送: + python-dev
消息: + msg195904
2013-08-21 17:48:18rhettinger修改文件: + no_refcnt_dummy2.diff

消息: + msg195810
2013-08-21 08:14:28pitrou修改消息: + msg195753
2013-08-21 08:11:13pitrou修改抄送: + tim.peters, Mark.Shannon
2013-08-21 08:05:04rhettinger修改抄送: + pitrou
2013-08-21 07:55:45rhettinger创建