forked from python/cpython
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pythonGH-113373: Slightly speed up path parsing in pathlib
Small improvements: - `Path('foo', '')` and `Path('foo') / ''` are improved by omitting an `os.path.join()` call. - The result of `os.path.join()` is stored and re-used for subsequent joins. Smaller improvements: - Check for the common case (`len(paths) == 0`) first, and speed up the subsequent `elif` by avoiding a length check - Don't bother assigning the `_parse_path()` result to local variables
- Loading branch information
1 parent
2f0ec7f
commit dc08c5d
Showing
3 changed files
with
19 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
Misc/NEWS.d/next/Library/2023-12-21-19-26-35.gh-issue-113373.QLaBAS.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Slightly speed up path parsing in :mod:`pathlib`. Patch by Barney Gale. |