Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
gh-104066: Improve performance of hasattr for module objects#104063
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
bedevere-bot commentedMay 1, 2023
carljm left a comment
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.
This looks fine to me; it's following the existing pattern already used to optimizehasattr for both types and normal objects, by avoiding raising and then suppressing anAttributeError.
Will leave it for a couple days before merging in case any other reviewers want to take a look.
Uh oh!
There was an error while loading.Please reload this page.
Fixesgh-104066
microbenchmark on main
microbenchmark with PR
the missing attr case is almost 10x faster