classification
Title: Simplify the fast nodes resize logic in C OrderedDict.
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.snow Nosy List: eric.snow, python-dev, skrah, yselivanov
Priority: release blocker Keywords: patch

Created on 2015-06-02 14:00 by eric.snow, last changed 2015-06-07 19:03 by Arfrever. This issue is now closed.

Files
File name Uploaded Description Edit
issue24362-odict-resize.diff eric.snow, 2015-06-02 22:47 review
Messages (5)
msg244667 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2015-06-02 14:00
Between comments on issue16991 and review comments there, it's clear that the implementation of _odict_resize and _odict_get_index in Objects/odictobject.c are too complicated to be a long-term solution.  simplifying the approach to avoid recursion should help substantially.
msg244708 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2015-06-02 22:47
Here's a patch that adds stores the hash on each node.  This eliminates the need to call PyObject_Hash when rebuilding the fast nodes table during a resize.  The patch also drops a superfluous while loop.
msg244746 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2015-06-03 13:52
I think this is much nicer, thank you!

And the XXX comment looks right, updating od_size could be moved
down.  I suspect that updating it too early was the cause for
#24361, which is also solved by this patch.
msg244772 - (view) Author: Roundup Robot (python-dev) Date: 2015-06-03 16:54
New changeset c78c5832ccc0 by Eric Snow in branch '3.5':
Issue #24362: Simplify the C OrderedDict fast nodes resize logic.
https://hg.python.org/cpython/rev/c78c5832ccc0
msg244773 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2015-06-03 16:55
Thanks for pushing this, Stefan (and Jim). :)
History
Date User Action Args
2015-06-07 19:03:42Arfreversetstatus: open -> closed
stage: patch review -> resolved
2015-06-03 16:55:46eric.snowsettype: behavior
resolution: fixed
messages: + msg244773
2015-06-03 16:54:49python-devsetnosy: + python-dev
messages: + msg244772
2015-06-03 13:52:51skrahsetmessages: + msg244746
2015-06-02 22:47:44eric.snowsetfiles: + issue24362-odict-resize.diff
keywords: + patch
messages: + msg244708

stage: needs patch -> patch review
2015-06-02 19:24:17yselivanovsetnosy: + yselivanov
2015-06-02 14:00:31eric.snowcreate