Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-107369: Optimisetextwrap.indent()#131923

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
AA-Turner merged 1 commit intopython:mainfromAA-Turner:tw-indent
Mar 31, 2025
Merged

Conversation

AA-Turner
Copy link
Member

@AA-TurnerAA-Turner commentedMar 31, 2025
edited by bedevere-appbot
Loading

Follow-up to#131919, I noticed there was opportunity for improvement here too, a ~30% speed-up.

Benchmarktextwrapnew
indent3.59 ms2.81 ms: 1.28x faster

Benchmarked by indenting the contents ofObjects/unicodeobject.c.

A

Copy link
Member

@picnixzpicnixz left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This is funny because this was my very first attempt at CPython:https://github.com/python/cpython/pull/107426/files :') It was rejected at that time (#107426 (comment)) though

@AA-Turner
Copy link
MemberAuthor

Oh, I didn't see that PR! I think the optimisation is worth it, it's a small change and a reasonable speed-up for the default case (predicate=None). I'll give you co-authored-by credit!

A

picnixz reacted with heart emoji

@AA-TurnerAA-Turner merged commit51e0f2b intopython:mainMar 31, 2025
45 checks passed
@AA-TurnerAA-Turner deleted the tw-indent branchMarch 31, 2025 17:31
@@ -0,0 +1,2 @@
Improved performance of :func:`textwrap.dedent` by an average of ~1.3x.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

s/dedent/indent/

seehwan pushed a commit to seehwan/cpython that referenced this pull requestApr 16, 2025
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@methanemethanemethane left review comments

@picnixzpicnixzpicnixz approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@AA-Turner@methane@picnixz

[8]ページ先頭

©2009-2025 Movatter.jp