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

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

Closed
rhettinger opened this issue Aug 21, 2013 · 4 comments
Closed

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

rhettinger opened this issue Aug 21, 2013 · 4 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@rhettinger
Copy link
Contributor

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']

    @rhettinger
    Copy link
    Contributor Author

    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?

    @rhettinger rhettinger added interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage labels Aug 21, 2013
    @pitrou
    Copy link
    Member

    pitrou commented Aug 21, 2013

    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.

    @rhettinger
    Copy link
    Contributor Author

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

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

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 22, 2013

    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

    @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
    interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants