-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
bpo-45565: Specialize LOAD_ATTR_CLASS #29146
Conversation
Stats for
|
Do you have stats for the standard benchmark suite (or something of similar scale), and have you benchmarked this? A couple of things that stand out:
|
No, I'll get some soon (pyperformance is a pain on Windows :().
The only possible way for deopt is for tp_version_tag to change, and that requires the class variable to be written to. So things like: class X:
x = 1
X.x = 2 Unfortunately, I have no clue how common something like this is in the real world. An alternative approach (with far fewer invalidations):
At runtime, look into The benefit is that
Indeed, I failed to see that |
Wow, somehow the stats for the alternative approach (mentioned above) is almost exactly the same as the old one using |
Some comments: class X:
x = 1
for _ in range(20):
X.x
print(_testcapi.type_get_version(X))
X.x = None However, approach 2 using MRO index works even with the test case above, some stats for the code:
|
This PR is stale because it has been open for 30 days with no activity. |
@Fidget-Spinner Is this abandoned, or are you planning to continue working on it? |
@iritkatriel this was completed in #93430). Thanks for the reminder! |
Almost same as
LOAD_METHOD_CLASS
.https://bugs.python.org/issue45565