Skip to content

GH-110109: Speed up pathlib._PathBase.resolve() - #110412

Merged
barneygale merged 3 commits into
python:mainfrom
barneygale:gh-110109-pathbase-resolve-speedups
Nov 17, 2023
Merged

GH-110109: Speed up pathlib._PathBase.resolve()#110412
barneygale merged 3 commits into
python:mainfrom
barneygale:gh-110109-pathbase-resolve-speedups

Conversation

@barneygale

@barneygalebarneygale commented Oct 5, 2023

Copy link
Copy Markdown
Contributor
  • Add fast path to _split_stack()
  • Skip unnecessarily resolution of the current directory when a relative path is given to resolve()
  • Remove stat and target caches, which slow down most resolve() calls in practice.
  • Slightly refactor code for clarity.

- Add fast path to `_split_stack()`
- Skip unnecessarily resolution of the current directory when a relative
path is given to `resolve()`
- Remove stat and target caches, which slow down most `resolve()` calls in
practice.
- Slightly refactor code for clarity.
@barneygalebarneygale added performance Performance or resource usage topic-pathlib labels Oct 5, 2023
@bedevere-appbedevere-appBot mentioned this pull request Oct 5, 2023
8 tasks
@barneygale
barneygale marked this pull request as ready for review October 5, 2023 19:45
@barneygale

Copy link
Copy Markdown
ContributorAuthor

This method can't yet be invoked using public APIs, so there's little risk here. Merging!

@barneygale
barneygale merged commit 9fb0f2d into python:mainNov 17, 2023
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
- Add fast path to `_split_stack()`
- Skip unnecessarily resolution of the current directory when a relative
path is given to `resolve()`
- Remove stat and target caches, which slow down most `resolve()` calls in
practice.
- Slightly refactor code for clarity.
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
- Add fast path to `_split_stack()`
- Skip unnecessarily resolution of the current directory when a relative
path is given to `resolve()`
- Remove stat and target caches, which slow down most `resolve()` calls in
practice.
- Slightly refactor code for clarity.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performancePerformance or resource usageskip newstopic-pathlib

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@barneygale