{{ message }}
gh-118761: improve optparse import time by delaying textwrap import#128899
Merged
AA-Turner merged 1 commit intoJan 20, 2025
Merged
gh-118761: improve optparse import time by delaying textwrap import#128899AA-Turner merged 1 commit into
AA-Turner merged 1 commit into
Conversation
1 task
ZeroIntensity
approved these changes
Jan 16, 2025
AA-Turner
reviewed
Jan 16, 2025
…port The same change was made, and for the same reason, by argparse back in 2017. The textwrap module is only used when printing help text, so most invocations will never need it imported. See: python#1269 See: 8110837
4484efc to
10cd152
Compare
January 17, 2025 00:44
Member
|
Out of curiosity, how are the |
Sorry, something went wrong.
Contributor
Author
|
As mentioned in the other PR -- I'm not used to benchmarking and I may be doing something totally wrong because I can get results saying this PR is now slower to import, or results saying it's faster, and hyperfine warns that I have lots of "outliers". But here's a favorable result. Produced by copying the old and new versions of the file so that I can import them both without switching branches: |
Sorry, something went wrong.
AA-Turner
approved these changes
Jan 20, 2025
srinivasreddy
pushed a commit
to srinivasreddy/cpython
that referenced
this pull request
Jan 21, 2025
The same change was made, and for the same reason, by ``argparse`` back in 2017. The ``textwrap`` module is only used when printing help text, so most invocations will never need it imported. Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
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
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.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.
The same change was made, and for the same reason, by argparse back in
2017. The textwrap module is only used when printing help text, so most invocations will never need it imported.
See: #1269
See: 8110837