-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Update property_descr_set to use vectorcall if possible. #88827
Comments
It shows a consistent 1-2% performance improvement. Mean +- std dev: [property_base] 40.6 ns +- 0.6 ns -> [property_vectorcall] 40.0 ns +- 0.7 ns: 1.01x faster |
Oops sorry, it was the wrong benchmark, it will be faster.. ;) Mean +- std dev: [property_base] 140 ns +- 5 ns -> [property_vectorcall] 125 ns +- 2 ns: 1.12x faster |
I updated the benchmark, and it shows 1.12x faster |
class Person:
def __init__(self):
self.__age = 0
@property
def age(self):
return self.__age
@age.setter
def age(self, value):
self.__age = value
p = Person()
p.age = 10 # Now become faster |
Ah! That's better. If it was only 1.01x faster, I would say that it's not worth it. But 1.12x is worth it. Thanks for this optimization. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: