Skip to content

Optimize pathlib #90306

Closed
Closed

Description

@kumaraditya303
BPO 46148
Nosy @pitrou, @tiran, @merwok, @MojoVampire, @sweeneyde, @FFY00, @barneygale
PRs
  • bpo-46148: Optimize pathlib  #30226
  • bpo-44953: Add vectorcall for itemgetter and attrgetter #27828
  • bpo-46148: optimize pathlib.Path.iterdir() #30492
  • 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 2022-01-05.12:18:52.858>
    created_at = <Date 2021-12-22.09:00:00.473>
    labels = ['3.11', 'library', 'performance']
    title = 'Optimize pathlib'
    updated_at = <Date 2022-01-09.09:41:34.187>
    user = 'https://github.com/kumaraditya303'

    bugs.python.org fields:

    activity = <Date 2022-01-09.09:41:34.187>
    actor = 'kumaraditya'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-01-05.12:18:52.858>
    closer = 'kumaraditya'
    components = ['Library (Lib)']
    creation = <Date 2021-12-22.09:00:00.473>
    creator = 'kumaraditya'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46148
    keywords = ['patch']
    message_count = 10.0
    messages = ['409015', '409023', '409025', '409026', '409048', '409059', '409060', '409064', '409758', '409773']
    nosy_count = 7.0
    nosy_names = ['pitrou', 'christian.heimes', 'eric.araujo', 'josh.r', 'Dennis Sweeney', 'FFY00', 'barneygale']
    pr_nums = ['30226', '27828', '30492']
    priority = 'normal'
    resolution = 'postponed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue46148'
    versions = ['Python 3.11']

    Activity

    1. kumaraditya303 commented on Dec 22, 2021

      @kumaraditya303
      ContributorAuthor

      Issue for tracking improving performance of pathlib module.

    2. added
      3.11
      stdlib
      performance
      on Dec 22, 2021
    3. tiran commented on Dec 22, 2021

      @tiran
      Member

      Please provide benchmarks and reasons in the ticket. A BPO issue should contain all relevant information for a change.

    4. kumaraditya303 commented on Dec 22, 2021

      @kumaraditya303
      ContributorAuthor

      Optimizations include:

      • Remove redundant check for functools lru_cache
      • Replace attrgetter as it is slower than direct access
    5. kumaraditya303 commented on Dec 22, 2021

      @kumaraditya303
      ContributorAuthor

      Benchmarks for attrgetter is provided in the PR.

    6. gvanrossum commented on Dec 22, 2021

      @gvanrossum
      Member

      I presume faster-cpython/ideas#194 is also relevant.

    7. MojoVampire commented on Dec 23, 2021

      MojoVampiremannequin
      Mannequin

      Note: attrgetter could easily be made faster by migrating it to use vectorcall.

    8. gvanrossum commented on Dec 23, 2021

      @gvanrossum
      Member

      Note: attrgetter could easily be made faster by migrating it to use vectorcall.

      Sure, though code that *doesn't* use attrgetter is usually easier to read -- attrgetter is rare enough in my experience that I usually have to look it up. So making attrgetter unnecessary in most cases would also be welcome.

      (The exception is when you have many trivial pass-through properties, or when the attribute name is a variable to begin with.)

    9. sweeneyde commented on Dec 23, 2021

      @sweeneyde
      Member

      I have #27828 open already to add vectorcall to itemgetter and attrgetter

    10. kumaraditya303 commented on Jan 5, 2022

      @kumaraditya303
      ContributorAuthor

      I am withdrawing this for now and since there is already a bpo for vectorcall I am closing this.

    11. merwok commented on Jan 5, 2022

      @merwok
      Member

      A note about benchmarks: I think timeit is not the right tool for them, but https://github.com/python/pyperformance is

    12. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.11performancestdlib

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions