bpo-39028: Performance enhancement in keyword extraction#17576
bpo-39028: Performance enhancement in keyword extraction#17576methane merged 2 commits intopython:masterfrom
Conversation
|
Ah, I missed that this code is used for EDIT: Both can make sense I guess, but for the clinic it is clearly interned I think? So another option is to have two versions here... |
Python/getargs.c
Outdated
There was a problem hiding this comment.
This comment is related to kwname == key.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
This change LGTM, but please move the comment before the pointers comparison or before the first loop.
Although this is almost dead code. It is used in just few sites generated by Argument Clinic and soon will not be used at all.
|
Ah, sorry, the use in |
ba65512 to
17561c2
Compare
|
Yeah, although it only will have remotely noticeable effects for >3 kwargs probably, which seems pretty rare in python. Anyway moved and tweaked the comment. |
Python/getargs.c
Outdated
There was a problem hiding this comment.
If we keep the second loop, why we need to have both of find_keyword_interned and find_keyword?
There was a problem hiding this comment.
Oh man, sorry, I do not think we do. I was trying around with it a bit, and apparently forgot to commit before pushing or something :/. fixed.
All keywords should first be checked for pointer identity. Only after that failed for all keywords (unlikely) should unicode equality be used. The original code would call unicode equality on any non-matching keyword argument. Meaning calling it often e.g. when a function has many kwargs but only the last one is provided.
17561c2 to
52562b9
Compare
|
LGTM. Would you create an NEWS entry? |
) All keywords should first be checked for pointer identity. Only after that failed for all keywords (unlikely) should unicode equality be used. The original code would call unicode equality on any non-matching keyword argument. Meaning calling it often e.g. when a function has many kwargs but only the last one is provided.
All keywords should first be checked for pointer identity. Only
after that failed for all keywords (unlikely) should unicode
equality be used.
The original code would call unicode equality on any non-matching
keyword argument. Meaning calling it often e.g. when a function
has many kwargs but only the last one is provided.
Unless I am missing something big, this seems like it was the original intention, and simple typo. It may make sense to backport?
I have to admit, I have not actually recompiled and timed this, I may do that tomorrow (but I have never had the need to compile python, so need to look up how).
https://bugs.python.org/issue39028