-
Notifications
You must be signed in to change notification settings - Fork 274
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
ENH: delay expensive imports #4265
ENH: delay expensive imports #4265
Conversation
a40c575
to
8863b83
Compare
Getting some errors at collection time in minimal env tests. I don't immediately get what's happening so I'll switch to draft for now. |
44c05c3
to
5e20545
Compare
I found that urllib.request, which is probably never actually used within yt, costs about 1% (and 2.5% with incoming improvements in our other dependencies) of startup overhead. It's definitely in the realm of fine tuning but it's basically free to implement, so I went for it too. |
21925fd
to
8f86151
Compare
@@ -23,6 +21,10 @@ | |||
validate_image_name, | |||
) | |||
|
|||
if TYPE_CHECKING: |
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 is a good thing to know about!
PR Summary
Reduces yt's startup time by ~30% (from 1.57s to 1.07s on my machine, averaged over 100 runs)
Measured with this simple script