Skip to content

Don't needlessly change refcounts of dummy objects for sets #62997

Closed

Description

@rhettinger
BPO 18797
Nosy @tim-one, @rhettinger, @pitrou, @markshannon
Files
  • no_refcnt_dummy1.diff: Use #ifdefs to remove dummy object refcount changes
  • no_refcnt_dummy2.diff: Version without #ifdef
  • 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 2013-08-22.16:01:38.849>
    created_at = <Date 2013-08-21.07:55:45.530>
    labels = ['interpreter-core', 'performance']
    title = "Don't needlessly change refcounts of dummy objects for sets"
    updated_at = <Date 2013-08-22.16:01:38.848>
    user = 'https://github.com/rhettinger'

    bugs.python.org fields:

    activity = <Date 2013-08-22.16:01:38.848>
    actor = 'rhettinger'
    assignee = 'none'
    closed = True
    closed_date = <Date 2013-08-22.16:01:38.849>
    closer = 'rhettinger'
    components = ['Interpreter Core']
    creation = <Date 2013-08-21.07:55:45.530>
    creator = 'rhettinger'
    dependencies = []
    files = ['31394', '31402']
    hgrepos = []
    issue_num = 18797
    keywords = ['patch']
    message_count = 4.0
    messages = ['195751', '195753', '195810', '195904']
    nosy_count = 5.0
    nosy_names = ['tim.peters', 'rhettinger', 'pitrou', 'Mark.Shannon', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue18797'
    versions = ['Python 3.4']

    Activity

    1. rhettinger commented on Aug 21, 2013

      @rhettinger
      ContributorAuthor

      AFAICT, there is no reason for sets to incref and decref dummy objects. The dummy object address is used as placeholders in the hash table but it is never accessed by set the logic. As long the one reference is held at the time the dummy object is created, nothing further is served by the increfs and decrefs.

      I can take them out entirely or use ifdefs to keep them for debug builds.

      Does anyone know of any issues?

    2. pitrou commented on Aug 21, 2013

      @pitrou
      Member

      I can't think of any counter-indication but I think we shouldn't distinguish between debug and non-debug mode. That way the debug hooks can check that the refcounting optimization is right.

    3. rhettinger commented on Aug 21, 2013

      @rhettinger
      ContributorAuthor

      I think we shouldn't distinguish between debug and non-debug mode.

      That makes good sense.
      Attaching a new patch without the #ifdefs.

    4. python-dev commented on Aug 22, 2013

      python-devmannequin
      Mannequin

      New changeset ac6dab1819c4 by Raymond Hettinger in branch 'default':
      bpo-18797: Remove unneeded refcount adjustments for dummy objects.
      http://hg.python.org/cpython/rev/ac6dab1819c4

    5. 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

      interpreter-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