GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Near zero-cost super().meth() calls via adaptive superinstructions · Issue #90722 · python/cpython

Near zero-cost super().meth() calls via adaptive superinstructions #90722

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
Near zero-cost super().meth() calls via adaptive superinstructions#90722
Copy link
Assignees
Fidget-Spinner
Labels
3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usage

Description

@Fidget-Spinner
Fidget-Spinner
opened on Jan 28, 2022
Issue body actions
BPO 46564
Nosy @markshannon, @corona10, @Fidget-Spinner, @kumaraditya303
PRs
  • bpo-46564: Optimize super().meth() calls via adaptive superinstructions #30992
  • bpo-46564: do not create frame object for super object #31002
  • 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 = 'https://github.com/Fidget-Spinner'
    closed_at = None
    created_at = <Date 2022-01-28.16:36:58.296>
    labels = ['interpreter-core', '3.11', 'performance']
    title = 'Near zero-cost super().meth() calls via adaptive superinstructions'
    updated_at = <Date 2022-03-29.17:49:41.787>
    user = 'https://github.com/Fidget-Spinner'

    bugs.python.org fields:

    activity = <Date 2022-03-29.17:49:41.787>
    actor = 'corona10'
    assignee = 'kj'
    closed = False
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2022-01-28.16:36:58.296>
    creator = 'kj'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46564
    keywords = ['patch']
    message_count = 6.0
    messages = ['412005', '412050', '412051', '412052', '412055', '412259']
    nosy_count = 4.0
    nosy_names = ['Mark.Shannon', 'corona10', 'kj', 'kumaraditya']
    pr_nums = ['30992', '31002']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue46564'
    versions = ['Python 3.11']

    Activity

    1. Fidget-Spinner commented on Jan 28, 2022

      @Fidget-Spinner
      Fidget-Spinner
      on Jan 28, 2022
      MemberAuthor
      More actions

      super().meth() is expensive. I propose to optimize 3 parts of this:

      1. Avoid creating a temporary super() proxy object.
      2. Avoid creating a bound method.
      3. Avoid method lookup in super MRO using the inline cache.

      Credit for 1. and 2. doesn't belong to me. Those were inspired by the excellent work done in bpo-43563.

      I'll do this by combining the adjacent CALL (super) and LOAD_METHOD instructions into CALL_NO_KW_SUPER__LOAD_METHOD. Using the specializer means:

      • We don't touch any compiler code.
      • This custom instruction isn't revealed to the user
      • I can make use of the 5 cache entries shared by both CALL_ADAPTIVE and LOAD_METHOD_ADAPTIVE.

      The final 2-argument super(type, obj).meth() form will have almost no overhead over a corresponding self.meth() call in the current implementation.

      Please see faster-cpython/ideas#242 and faster-cpython/ideas#239 for more info.

    2. Fidget-Spinner
      added
      3.11only security fixesonly security fixes
      on Jan 28, 2022
    3. Fidget-Spinner
      self-assigned this
      on Jan 28, 2022
    4. Fidget-Spinner
      added
      interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
      performancePerformance or resource usagePerformance or resource usage
      on Jan 28, 2022
    5. kumaraditya303 commented on Jan 29, 2022

      @kumaraditya303
      kumaraditya303
      on Jan 29, 2022
      Contributor
      More actions

      I was reading typeobject.c and noticed that creating a super object currently requires creating a frame object which is created lazily and is slow and it would work with the InterpreterFrame as well so I created a PR for this optimization and now it does not requires creating frame objects.

    6. Fidget-Spinner commented on Jan 29, 2022

      @Fidget-Spinner
      Fidget-Spinner
      on Jan 29, 2022
      MemberAuthor
      More actions

      @Kumar, my PR already has your changes.

    7. kumaraditya303 commented on Jan 29, 2022

      @kumaraditya303
      kumaraditya303
      on Jan 29, 2022
      Contributor
      More actions

      Oh, I didn't see your PR and commented as it was not mentioned in this bpo. Would you like to split the PR or continue with yours, either way is fine?

    8. Fidget-Spinner commented on Jan 29, 2022

      @Fidget-Spinner
      Fidget-Spinner
      on Jan 29, 2022
      MemberAuthor
      More actions

      Oh, I didn't see your PR and commented as it was not mentioned in this bpo.

      No problem. In the future please check the "Pull Requests" section on the issue. People don't always say "I created a PR at xxx". Often times we just link the PR into the issue itself.

      Keep your PR around in case mine gets rejected, then we can take just the good parts. If mine's accepted, we can close yours.

    9. Fidget-Spinner commented on Feb 1, 2022

      @Fidget-Spinner
      Fidget-Spinner
      on Feb 1, 2022
      MemberAuthor
      More actions

      New changeset b9ebde8 by Kumar Aditya in branch 'main':
      bpo-46564: do not create frame object for super object (GH-31002)
      b9ebde8

    10. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    11. iritkatriel
      added
      3.12only security fixesonly security fixes
      and removed
      3.11only security fixesonly security fixes
      on Sep 12, 2022
    12. Fidget-Spinner commented on Apr 27, 2023

      @Fidget-Spinner
      Fidget-Spinner
      on Apr 27, 2023
      MemberAuthor
      More actions

      Superseded by #87729.

    13. Fidget-Spinner
      closed this as not plannedon Apr 27, 2023
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    • @Fidget-Spinner
      Fidget-Spinner

    Labels

    3.12only security fixesonly security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usage

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.