Defer import of zipp#502
Merged
jaraco merged 3 commits intopython:mainfrom Sep 11, 2024
danielhollas:defer-zipp
Merged
Conversation
This was referenced Aug 27, 2024
Member
|
I'm starting to feel like a frog being slowly boiled. I'm seeing repeated optimizations like this being handled piecemeal, and each time I do, I need to go through the same process: point out that there's a systemic problem that has no solution, ensure there's a comment protecting the change and linking to the motivation, then merge and roll out the change. </rant> Looks good. I'll add the comment linking back to the motivation and analysis (here). Thanks for the contrib. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Impoting zipp takes between 2-4 ms on my machine, which is at least 10% of overall import time of the
importlib_metadatapackage (depending on Python version). Since this package is only used in a single code path it makes sense to defer it.To estimate the cost of repeatedly calling
import zippI ran(this is with cpython main branch)
Since this is in a codepath that reads a zipfile from disk, this overhead is negligible.