-
Notifications
You must be signed in to change notification settings - Fork 6k
cache packages_distributions #11453
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
cache packages_distributions #11453
Conversation
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.
Thanks, makes sense!
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Signed-off-by: Vladimir Mandic <[email protected]>
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.
thanks!
@DN6 could you take a look here too? |
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.
Small nit. Could we make package_map
and internal variable _package_map
. Good to merge after.
@DN6 can you make the edits as you like? I'm really not sure on exactly what do you want as that introduces second variable that is not accessed anywhere else. |
pr #11161 refactored
_is_package_available
,but it introduced a major performance regression.
diffusers load now takes up to ~5sec while it was taking ~0.5sec earlier.
this is due to very expensive call to
importlib_metadata.packages_distributions()
which is done for every single installed package (each call can be ~0.2sec and it quickly adds up).this pr simply changes the logic so the call is done once and cached.
result is that diffusers startup is back to 0.5sec as usual.
cc @yiyixuxu @sayakpaul @a-r-r-o-w