Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
GH-112361: Speed up pathlib by removing some temporary objects.#112362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Construct only one new list object (using `list.copy()`) when creating anew path object with a modified tail. This slightly speeds up`with_name()`, `with_suffix()`, `_make_child_relpath()` (used in walkingand globbing), and `glob()`.
barneygale commentedNov 24, 2023
Timings: |
AlexWaygood left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Overall this looks really nice -- great work! I can reproduce the big speedups from the first three benchmarks in#112362 (comment).
Ican't repro the reported speedup for_make_child_relpath, though (the fourth benchmark from#112362 (comment)) -- if anything, it looks like this PR makes it slightlyslower for me locally? (I'm on Windows with a fresh PGO-optimised build frommain.)
Uh oh!
There was an error while loading.Please reload this page.
barneygale commentedNov 25, 2023
Hm. With a fresh PGO rebuild on Linux I still see an improvement, but it's really marginal - only 2% faster. I'll take the change out of the PR. |
AlexWaygood left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Looks great, thanks!
barneygale commentedNov 25, 2023
Thank you for the review Alex! |
…python#112362)Construct only one new list object (using `list.copy()`) when creating anew path object with a modified tail. This slightly speeds up`with_name()` and `with_suffix()`
…python#112362)Construct only one new list object (using `list.copy()`) when creating anew path object with a modified tail. This slightly speeds up`with_name()` and `with_suffix()`
Uh oh!
There was an error while loading.Please reload this page.
Construct only one new list object (using
list.copy()) when creating a new path object with a modified tail. This slightly speeds upwith_name(),with_suffix(),_make_child_relpath()(used in walking and globbing), andglob().