Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Oct 5, 2023

  • 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.
@barneygale barneygale added performance Performance or resource usage topic-pathlib labels Oct 5, 2023
@bedevere-app bedevere-app bot 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
Contributor Author

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

@barneygale barneygale merged commit 9fb0f2d into python:main Nov 17, 2023
25 checks passed
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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance or resource usage skip news topic-pathlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant