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

Reduce de-optimization in BINARY_OP_INPLACE_ADD_UNICODE #91209

Closed
sweeneyde opened this issue Mar 17, 2022 · 3 comments
Closed

Reduce de-optimization in BINARY_OP_INPLACE_ADD_UNICODE #91209

sweeneyde opened this issue Mar 17, 2022 · 3 comments
Labels
3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@sweeneyde
Copy link
Member

BPO 47053
Nosy @markshannon, @brandtbucher, @sweeneyde
PRs
  • bpo-47053: Reduce deoptimization in BINARY_OP_INPLACE_ADD_UNICODE #31318
  • bpo-47053: Refactor BINARY_OP_INPLACE_ADD_UNICODE #32122
  • 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 = None
    created_at = <Date 2022-03-17.22:44:38.839>
    labels = ['interpreter-core', '3.11', 'performance']
    title = 'Reduce de-optimization in BINARY_OP_INPLACE_ADD_UNICODE'
    updated_at = <Date 2022-03-29.02:07:19.354>
    user = 'https://github.com/sweeneyde'

    bugs.python.org fields:

    activity = <Date 2022-03-29.02:07:19.354>
    actor = 'Dennis Sweeney'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2022-03-17.22:44:38.839>
    creator = 'Dennis Sweeney'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 47053
    keywords = ['patch']
    message_count = 3.0
    messages = ['415455', '416008', '416238']
    nosy_count = 3.0
    nosy_names = ['Mark.Shannon', 'brandtbucher', 'Dennis Sweeney']
    pr_nums = ['31318', '32122']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue47053'
    versions = ['Python 3.11']

    @sweeneyde
    Copy link
    Member Author

    There was a discussion here: faster-cpython/ideas#269

    Checking for whether the assignment target is the left-hand side, rather than just checking for the right refcount, is more stable and reduces the number of deoptimizations, and even increases performance on some benchmarks.

    Note that PyUnicode_Append is already a somewhat expensive function that already checks for the right reference counts, so it's fine to let as much code as possible get there, even if it will take the slow path -- we mostly just want to reduce allocations and avoid the quadratic string concatenation otherwise.

    @sweeneyde sweeneyde added type-security A security issue 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage and removed type-security A security issue labels Mar 17, 2022
    @markshannon
    Copy link
    Member

    New changeset cca43b7 by Dennis Sweeney in branch 'main':
    bpo-47053: Reduce deoptimization in BINARY_OP_INPLACE_ADD_UNICODE (GH-31318)
    cca43b7

    @sweeneyde
    Copy link
    Member Author

    New changeset 7881549 by Dennis Sweeney in branch 'main':
    bpo-47053: Refactor BINARY_OP_INPLACE_ADD_UNICODE (GH-32122)
    7881549

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

    No branches or pull requests

    2 participants