]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-110109: Speed up `pathlib._PathBase.resolve()` (#110412)
authorBarney Gale <barney.gale@gmail.com>
Fri, 17 Nov 2023 16:58:17 +0000 (16:58 +0000)
committerGitHub <noreply@github.com>
Fri, 17 Nov 2023 16:58:17 +0000 (16:58 +0000)
commit9fb0f2dfeed6cf534b0188154e96b976d6a67152
tree28939f620b2ae9d435cfa486518db90482d0c03c
parent25538c72d14a9fe249d1ff279eefa0ef3ab7bee2
GH-110109: Speed up `pathlib._PathBase.resolve()` (#110412)

- 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.
Lib/pathlib.py