classification
Title: Optimize Path.cwd() in pathlib
Type: performance Stage: resolved
Components: Library (Lib) Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eric.smith, kfollstad
Priority: normal Keywords: patch

Created on 2021-04-28 20:41 by kfollstad, last changed 2021-04-28 23:03 by eric.smith. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 25699 merged kfollstad, 2021-04-28 20:45
Messages (3)
msg392255 - (view) Author: Kevin Follstad (kfollstad) * Date: 2021-04-28 20:41
python3.10 -m timeit -r 5 -n 100000 -s 'from pathlib import Path' 'Path.cwd()'
100000 loops, best of 5: 206 usec per loop

python3.10-mypatch -m timeit -r 5 -n 100000 -s 'from pathlib import Path' 'Path.cwd()'
100000 loops, best of 5: 156 usec per loop
msg392266 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-04-28 23:01
New changeset 4a85718212fd032c922ca7d630b2602dd4b29a35 by kfollstad in branch 'master':
bpo-43970: Optimize Path.cwd() in pathlib by not instantiating a class unnecessarily (GH-25699)
https://github.com/python/cpython/commit/4a85718212fd032c922ca7d630b2602dd4b29a35
msg392267 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-04-28 23:03
I'm merging this not so much because of the performance aspect, but just to remove some unnecessary code.

But in any event, thanks for the contribution!
History
Date User Action Args
2021-04-28 23:03:04eric.smithsetstatus: open -> closed
resolution: fixed
messages: + msg392267

stage: patch review -> resolved
2021-04-28 23:01:58eric.smithsetnosy: + eric.smith
messages: + msg392266
2021-04-28 20:45:56kfollstadsetkeywords: + patch
stage: patch review
pull_requests: + pull_request24388
2021-04-28 20:41:53kfollstadcreate