Closed
Description
A handful of pathlib methods that create paths with modified names, or additional segments, use list objects that are quickly thrown away. We can speed these methods up by only creating new lists where strictly necessary.
Specifically:
with_name()
(performance ofself._tail[:-1] + [name]
is cursed)with_suffix()
_make_child_relpath()
(used inglob()
andwalk()
)glob()
(when parsing the pattern)