Sitelet https://github.com/python/cpython/issues/90043
Skip to content

Specialize COMPARE_OP #90043

Description

@sweeneyde
BPO 45885
Nosy @markshannon, @brandtbucher, @sweeneyde
PRs
  • bpo-45885: Specialize COMPARE_OP #29734
  • bpo-45885: Add more stats for COMPARE_OP in specialize.c #31040
  • bpo-45885: Don't un-adapt COMPARE_OP when collecting stats #31516
  • 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-12-03.23:45:56.141>
    created_at = <Date 2021-11-23.21:00:24.137>
    labels = ['interpreter-core', '3.11', 'performance']
    title = 'Specialize COMPARE_OP'
    updated_at = <Date 2022-02-23.11:06:35.684>
    user = 'https://github.com/sweeneyde'

    bugs.python.org fields:

    activity = <Date 2022-02-23.11:06:35.684>
    actor = 'Mark.Shannon'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-12-03.23:45:56.141>
    closer = 'Dennis Sweeney'
    components = ['Interpreter Core']
    creation = <Date 2021-11-23.21:00:24.137>
    creator = 'Dennis Sweeney'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45885
    keywords = ['patch']
    message_count = 5.0
    messages = ['406887', '406930', '407577', '412441', '413784']
    nosy_count = 3.0
    nosy_names = ['Mark.Shannon', 'brandtbucher', 'Dennis Sweeney']
    pr_nums = ['29734', '31040', '31516']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue45885'
    versions = ['Python 3.11']

    Linked PRs

    Activity

    1. sweeneyde commented on Nov 23, 2021

      @sweeneyde
      MemberAuthor

      Some specialization statistics:

      https://gist.github.com/sweeneyde/49cc3a9d074d56cf095cb0a42d13d7a4

      Including 3 opcodes: COMPARE_OP_INT and COMPARE_OP_FLOAT and COMPARE_OP_STR (equality only) seems to give pretty good specialization numbers, better than just 2.

    2. added
      3.11only security fixes
      interpreter-core(Objects, Python, Grammar, and Parser dirs)
      performancePerformance or resource usage
      on Nov 23, 2021
    3. markshannon commented on Nov 24, 2021

      @markshannon
      Member

      Is COMPARE_OP worth specializing by itself?

      Most comparisons are followed by a jump, and much of the overhead is in the branching around the choice of operator as well as pushing and popping (with inc/decrefs) a value that has only one bit of information (True/False).

    4. markshannon commented on Dec 3, 2021

      @markshannon
      Member

      New changeset 03768c4 by Dennis Sweeney in branch 'main':
      bpo-45885: Specialize COMPARE_OP (GH-29734)
      03768c4

    5. markshannon commented on Feb 3, 2022

      @markshannon
      Member

      New changeset 674ab66 by Dennis Sweeney in branch 'main':
      bpo-45885: Add more stats for COMPARE_OP in specialize.c (GH-31040)
      674ab66

    6. markshannon commented on Feb 23, 2022

      @markshannon
      Member

      New changeset 375a56b by Brandt Bucher in branch 'main':
      bpo-45885: Don't un-adapt COMPARE_OP when collecting stats (GH-31516)
      375a56b

    7. transferred this issue fromon Apr 10, 2022
    8. added a commit that references this issue on Dec 16, 2022
    9. added a commit that references this issue on Dec 16, 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.11only security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usage

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions