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-112405: Optimisepathlib.Path.relative_to#112406

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
AlexWaygood merged 4 commits intopython:mainfromAlexWaygood:pathlib-itertools
Nov 26, 2023

Conversation

@AlexWaygood
Copy link
Member

@AlexWaygoodAlexWaygood commentedNov 25, 2023
edited
Loading

Onmain (Windows machine, PGO-optimised build):

>python -m timeit -s "from pathlib import Path; p = Path('a/b/c/d/e/f/g')" "p.relative_to('a/b/c/d')"Running PGUpdate|x64 interpreter...10000 loops, best of 5: 28.7 usec per loop

With this PR:

>python -m timeit -s "from pathlib import Path; p = Path('a/b/c/d/e/f/g')" "p.relative_to('a/b/c/d')"Running PGUpdate|x64 interpreter...20000 loops, best of 5: 19.5 usec per loop

Fixes#112405

stonebig and edgarrmondragon reacted with heart emoji
@AlexWaygoodAlexWaygood added type-featureA feature request or enhancement performancePerformance or resource usage topic-pathlib labelsNov 25, 2023
@AlexWaygood
Copy link
MemberAuthor

itertools is an extremely fast import; this makes ~no difference to pathlib's import time :)

Copy link
Contributor

@itamaroitamaro left a comment

Choose a reason for hiding this comment

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

nice win!

Co-authored-by: Itamar Oren <itamarost@gmail.com>
Copy link
Contributor

@barneygalebarneygale left a comment

Choose a reason for hiding this comment

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

Lovely stuff

…OtzxC.rstCo-authored-by: Barney Gale <barney.gale@gmail.com>
@AlexWaygood
Copy link
MemberAuthor

Thanks both! :D

@AlexWaygoodAlexWaygoodenabled auto-merge (squash)November 26, 2023 15:40
@AlexWaygoodAlexWaygood merged commit418d585 intopython:mainNov 26, 2023
@AlexWaygoodAlexWaygood deleted the pathlib-itertools branchNovember 26, 2023 15:56
aisk pushed a commit to aisk/cpython that referenced this pull requestFeb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull requestSep 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@itamaroitamaroitamaro approved these changes

@barneygalebarneygalebarneygale approved these changes

Assignees

No one assigned

Labels

performancePerformance or resource usagetopic-pathlibtype-featureA feature request or enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Optimisepathlib.Path.relative_to()

3 participants

@AlexWaygood@itamaro@barneygale

[8]ページ先頭

©2009-2025 Movatter.jp