-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
GH-100288: Skip extra work when failing to specialize LOAD_ATTR
#101354
Conversation
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.
Thanks. Could you also move the body of the if
statement into the switch
case.
Python/specialize.c
Outdated
@@ -1093,7 +1093,7 @@ PyObject *descr, DescriptorClassification kind) | |||
} | |||
} | |||
} | |||
if (dictkind == MANAGED_VALUES || dictkind == OFFSET_DICT) { | |||
if (dictkind == MANAGED_VALUES) { |
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.
Since there is only the one case now, it would make the code easier to follow if this were moved into the case MANAGED_VALUES:
below.
Can I just get rid of the |
Sounds good to me. We can then get rid of |
Looks good. |
Confirmed locally that this doesn't change the stats. |
* main: pythonGH-100288: Skip extra work when failing to specialize LOAD_ATTR (pythonGH-101354) pythongh-101409: Improve generated clinic code for self type checks (python#101411) pythongh-98831: rewrite BEFORE_ASYNC_WITH and END_ASYNC_FOR in the instruction definition DSL (python#101458) pythongh-101469: Optimise get_io_state() by using _PyModule_GetState() (pythonGH-101470)
I think this was missed in #100753.
This removes a dict lookup, a dict version, and a cache write from one case where we fail to specialize method loads (due to the existence of a non-managed instance
__dict__
).