Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify the fast nodes resize logic in C OrderedDict. #68550

Closed
ericsnowcurrently opened this issue Jun 2, 2015 · 5 comments
Closed

Simplify the fast nodes resize logic in C OrderedDict. #68550

ericsnowcurrently opened this issue Jun 2, 2015 · 5 comments
Assignees
Labels
release-blocker stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@ericsnowcurrently
Copy link
Member

BPO 24362
Nosy @skrah, @ericsnowcurrently, @1st1
Files
  • issue24362-odict-resize.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ericsnowcurrently'
    closed_at = <Date 2015-06-07.19:03:42.123>
    created_at = <Date 2015-06-02.14:00:31.608>
    labels = ['type-bug', 'library', 'release-blocker']
    title = 'Simplify the fast nodes resize logic in C OrderedDict.'
    updated_at = <Date 2015-06-07.19:03:42.122>
    user = 'https://github.com/ericsnowcurrently'

    bugs.python.org fields:

    activity = <Date 2015-06-07.19:03:42.122>
    actor = 'Arfrever'
    assignee = 'eric.snow'
    closed = True
    closed_date = <Date 2015-06-07.19:03:42.123>
    closer = 'Arfrever'
    components = ['Library (Lib)']
    creation = <Date 2015-06-02.14:00:31.608>
    creator = 'eric.snow'
    dependencies = []
    files = ['39598']
    hgrepos = []
    issue_num = 24362
    keywords = ['patch']
    message_count = 5.0
    messages = ['244667', '244708', '244746', '244772', '244773']
    nosy_count = 4.0
    nosy_names = ['skrah', 'python-dev', 'eric.snow', 'yselivanov']
    pr_nums = []
    priority = 'release blocker'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue24362'
    versions = ['Python 3.5', 'Python 3.6']

    @ericsnowcurrently
    Copy link
    Member Author

    Between comments on bpo-16991 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.

    @ericsnowcurrently ericsnowcurrently self-assigned this Jun 2, 2015
    @ericsnowcurrently ericsnowcurrently added the stdlib Python modules in the Lib dir label Jun 2, 2015
    @ericsnowcurrently
    Copy link
    Member Author

    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.

    @skrah
    Copy link
    Mannequin

    skrah mannequin commented Jun 3, 2015

    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
    bpo-24361, which is also solved by this patch.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 3, 2015

    New changeset c78c5832ccc0 by Eric Snow in branch '3.5':
    Issue bpo-24362: Simplify the C OrderedDict fast nodes resize logic.
    https://hg.python.org/cpython/rev/c78c5832ccc0

    @ericsnowcurrently
    Copy link
    Member Author

    Thanks for pushing this, Stefan (and Jim). :)

    @ericsnowcurrently ericsnowcurrently added the type-bug An unexpected behavior, bug, or error label Jun 3, 2015
    @Arfrever Arfrever mannequin closed this as completed Jun 7, 2015
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    release-blocker stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant