-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Improve performance of _typing_extra
module
#11255
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
Conversation
Deploying pydantic-docs with
|
Latest commit: |
6f56712
|
Status: | ✅ Deploy successful! |
Preview URL: | https://e27b80b8.pydantic-docs.pages.dev |
Branch Preview URL: | https://typing-extra-perf.pydantic-docs.pages.dev |
9dc2303
to
48fc1d3
Compare
CodSpeed Performance ReportMerging #11255 will not alter performanceComparing Summary
|
48fc1d3
to
c219e23
Compare
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
pydantic/_internal/_typing_extra.py
Outdated
@@ -58,7 +40,7 @@ def is_any(tp: Any, /) -> bool: | |||
#> True | |||
``` | |||
""" | |||
return _is_typing_name(tp, name='Any') | |||
return tp is typing.Any or tp is t_e.Any |
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.
I wonder if it's worth importing everything by name and avoiding the attribute access, in my test it reduced the time from about 30ns to 20ns?
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.
Looking great otherwise!
Change Summary
Related issue number
Checklist