◐ Shell
clean mode source ↗

GH-112361: Speed up pathlib by removing some temporary objects. by barneygale · Pull Request #112362 · python/cpython

Construct only one new list object (using `list.copy()`) when creating a
new path object with a modified tail. This slightly speeds up
`with_name()`, `with_suffix()`, `_make_child_relpath()` (used in walking
and globbing), and `glob()`.

AlexWaygood

@barneygale

AlexWaygood

aisk pushed a commit to aisk/cpython that referenced this pull request

Feb 11, 2024
…python#112362)

Construct only one new list object (using `list.copy()`) when creating a
new path object with a modified tail. This slightly speeds up
`with_name()` and `with_suffix()`

Glyphack pushed a commit to Glyphack/cpython that referenced this pull request

Sep 2, 2024
…python#112362)

Construct only one new list object (using `list.copy()`) when creating a
new path object with a modified tail. This slightly speeds up
`with_name()` and `with_suffix()`