-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-29312: use METH_FASTCALL for dict.update #14589
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
Conversation
35484d9
to
06302fe
Compare
Here are some benchmarks:
So the calls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your PR title says "use METH_FASTCALL for dict.update" but you modified PyDictType.tp_init as well. Can you please move your tp_init change in a separated PR?
I changed the branch to match the title, reverting the changes to Note that this PR has more code duplication: the code paths for |
|
||
_Py_IDENTIFIER(keys); | ||
PyObject *func; | ||
if (_PyObject_LookupAttrId(obj, &PyId_keys, &func) < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds redundant with dict_merge() which calls PyMapping_Keys(). Maybe dict_merge() could be modified to dispatch to PyDict_MergeFromSeq2() if PyMapping_Keys() keys with an attribute error, rather than trying to get the attribute twice?
It's not directly related to your change, it can be done/discussed in a separated PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I also noticed this. There is some room for improvement here. Let's do it in a new PR after this is merged.
Base PR for other PRs that want to play with `type.__call__` such as #13930 and #14589. The author is really @markshannon I just made the PR. https://bugs.python.org/issue37207 Automerge-Triggered-By: @encukou
Rebased to latest master, using #14682. |
@methane: I let you decide what do to do with this change. |
Base PR for other PRs that want to play with `type.__call__` such as python#13930 and python#14589. The author is really @markshannon I just made the PR. https://bugs.python.org/issue37207 Automerge-Triggered-By: @encukou
Base PR for other PRs that want to play with `type.__call__` such as python#13930 and python#14589. The author is really @markshannon I just made the PR. https://bugs.python.org/issue37207 Automerge-Triggered-By: @encukou
Base PR for other PRs that want to play with `type.__call__` such as python#13930 and python#14589. The author is really @markshannon I just made the PR. https://bugs.python.org/issue37207 Automerge-Triggered-By: @encukou
https://bugs.python.org/issue29312 is closed. What is that status of this PR? |
Yes. This PR is also rejected. |
https://bugs.python.org/issue29312