Skip to content

bpo-40889: special-case dict.items() ^ dict.items() for performance#20718

Merged
methane merged 10 commits into
python:masterfrom
sweeneyde:dictitems_xor
Jun 10, 2020
Merged

bpo-40889: special-case dict.items() ^ dict.items() for performance#20718
methane merged 10 commits into
python:masterfrom
sweeneyde:dictitems_xor

Conversation

@sweeneyde

@sweeneyde sweeneyde commented Jun 8, 2020

Copy link
Copy Markdown
Member

Comment thread Objects/dictobject.c Outdated
Co-authored-by: Inada Naoki <songofacandy@gmail.com>
Comment thread Objects/dictobject.c Outdated
Comment thread Objects/dictobject.c Outdated
Comment thread Objects/dictobject.c Outdated
Comment thread Objects/dictobject.c
return NULL;
}

PyObject *key = NULL, *val1 = NULL, *val2 = NULL;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally expect these declarations to go at the top of the function (it's not required but it is the usual style in our C code).

@rhettinger

Copy link
Copy Markdown
Contributor

Aside from the stylistic clean-ups of moving the declarations to the top of the function, this all looks fine to me. Will wait for Inada to take another look.

@methane

methane commented Jun 10, 2020

Copy link
Copy Markdown
Member

This PR doesn't check that d2 size is changed during iteration.
But it is undefined behavior and I can not find crashing case. LGTM

@methane
methane merged commit 07d8112 into python:master Jun 10, 2020
@sweeneyde
sweeneyde deleted the dictitems_xor branch January 25, 2022 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants