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 itemgetter() #79845

Closed
rhettinger opened this issue Jan 5, 2019 · 3 comments
Closed

Optimize itemgetter() #79845

rhettinger opened this issue Jan 5, 2019 · 3 comments
Labels
3.8 only security fixes performance Performance or resource usage stdlib Python modules in the Lib dir

Comments

@rhettinger
Copy link
Contributor

BPO 35664
Nosy @rhettinger, @serhiy-storchaka
PRs
  • bpo-35664: Optimize operator.itemgetter #11435
  • bpo-35664: Optimize operator.itemgetter #11435
  • bpo-35664: Optimize operator.itemgetter #11435
  • 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 2019-01-07.16:39:30.595>
    created_at = <Date 2019-01-05.05:17:56.722>
    labels = ['3.8', 'library', 'performance']
    title = 'Optimize itemgetter()'
    updated_at = <Date 2019-01-07.16:39:30.595>
    user = 'https://github.com/rhettinger'

    bugs.python.org fields:

    activity = <Date 2019-01-07.16:39:30.595>
    actor = 'rhettinger'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-01-07.16:39:30.595>
    closer = 'rhettinger'
    components = ['Library (Lib)']
    creation = <Date 2019-01-05.05:17:56.722>
    creator = 'rhettinger'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 35664
    keywords = ['patch', 'patch', 'patch']
    message_count = 3.0
    messages = ['333041', '333047', '333175']
    nosy_count = 2.0
    nosy_names = ['rhettinger', 'serhiy.storchaka']
    pr_nums = ['11435', '11435', '11435']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue35664'
    versions = ['Python 3.8']

    @rhettinger
    Copy link
    Contributor Author

    Improve performance by 33% by optimizing argument handling and by adding a fast path for the common case of a single non-negative integer index into a tuple (which is the typical use case in the standard library).

    @rhettinger rhettinger added 3.8 only security fixes stdlib Python modules in the Lib dir performance Performance or resource usage labels Jan 5, 2019
    @serhiy-storchaka
    Copy link
    Member

    Please provide microbenchmark results also for the following cases:

    • Negative index with tuple.
    • Slice index with tuple.
    • Tuple subclass.
    • List.
    • Large (2**61 and -2**61) index.

    I do not expect significant regression, but if it is, we should be aware.

    If the above cases are not covered by tests, it may be worth to add them.

    @rhettinger
    Copy link
    Contributor Author

    New changeset 2d53bed by Raymond Hettinger in branch 'master':
    bpo-35664: Optimize operator.itemgetter (GH-11435)
    2d53bed

    @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.8 only security fixes performance Performance or resource usage stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants