Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize Path.cwd() in pathlib #88136

Closed
kfollstad mannequin opened this issue Apr 28, 2021 · 3 comments
Closed

Optimize Path.cwd() in pathlib #88136

kfollstad mannequin opened this issue Apr 28, 2021 · 3 comments
Labels
3.10 only security fixes performance Performance or resource usage stdlib Python modules in the Lib dir

Comments

@kfollstad
Copy link
Mannequin

kfollstad mannequin commented Apr 28, 2021

BPO 43970
Nosy @ericvsmith, @kfollstad
PRs
  • bpo-43970: Optimize Path.cwd() in pathlib #25699
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-04-28.23:03:04.453>
    created_at = <Date 2021-04-28.20:41:53.343>
    labels = ['library', '3.10', 'performance']
    title = 'Optimize Path.cwd() in pathlib'
    updated_at = <Date 2021-04-28.23:03:04.453>
    user = 'https://github.com/kfollstad'

    bugs.python.org fields:

    activity = <Date 2021-04-28.23:03:04.453>
    actor = 'eric.smith'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-04-28.23:03:04.453>
    closer = 'eric.smith'
    components = ['Library (Lib)']
    creation = <Date 2021-04-28.20:41:53.343>
    creator = 'kfollstad'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43970
    keywords = ['patch']
    message_count = 3.0
    messages = ['392255', '392266', '392267']
    nosy_count = 2.0
    nosy_names = ['eric.smith', 'kfollstad']
    pr_nums = ['25699']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue43970'
    versions = ['Python 3.10']

    @kfollstad
    Copy link
    Mannequin Author

    kfollstad mannequin commented Apr 28, 2021

    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

    @kfollstad kfollstad mannequin added 3.10 only security fixes stdlib Python modules in the Lib dir performance Performance or resource usage labels Apr 28, 2021
    @ericvsmith
    Copy link
    Member

    New changeset 4a85718 by kfollstad in branch 'master':
    bpo-43970: Optimize Path.cwd() in pathlib by not instantiating a class unnecessarily (GH-25699)
    4a85718

    @ericvsmith
    Copy link
    Member

    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!

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.10 only security fixes performance Performance or resource usage stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant