GH-112361: Speed up pathlib by removing some temporary objects. (#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()`
This commit is contained in:
Barney Gale 2023-11-25 17:19:38 +00:00 committed by GitHub
parent 6b961b8cea
commit 19a1fc1b3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 22 deletions

View file

@ -0,0 +1,2 @@
Speed up a small handful of :mod:`pathlib` methods by removing some
temporary objects.