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

Specialize UNPACK_SEQUENCE #90858

Closed
brandtbucher opened this issue Feb 10, 2022 · 4 comments
Closed

Specialize UNPACK_SEQUENCE #90858

brandtbucher opened this issue Feb 10, 2022 · 4 comments
Assignees
Labels
3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@brandtbucher
Copy link
Member

BPO 46702
Nosy @markshannon, @brandtbucher
PRs
  • bpo-46702: Specialize UNPACK_SEQUENCE #31240
  • 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/brandtbucher'
    closed_at = <Date 2022-02-18.21:19:36.450>
    created_at = <Date 2022-02-10.00:35:53.502>
    labels = ['interpreter-core', '3.11', 'performance']
    title = 'Specialize UNPACK_SEQUENCE'
    updated_at = <Date 2022-02-18.21:19:36.449>
    user = 'https://github.com/brandtbucher'

    bugs.python.org fields:

    activity = <Date 2022-02-18.21:19:36.449>
    actor = 'brandtbucher'
    assignee = 'brandtbucher'
    closed = True
    closed_date = <Date 2022-02-18.21:19:36.450>
    closer = 'brandtbucher'
    components = ['Interpreter Core']
    creation = <Date 2022-02-10.00:35:53.502>
    creator = 'brandtbucher'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46702
    keywords = ['patch']
    message_count = 4.0
    messages = ['412960', '412962', '413340', '413512']
    nosy_count = 2.0
    nosy_names = ['Mark.Shannon', 'brandtbucher']
    pr_nums = ['31240']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue46702'
    versions = ['Python 3.11']

    @brandtbucher
    Copy link
    Member Author

    UNPACK_SEQUENCE already has fast paths for tuples and lists, which make up (literally) 99% of unpackings in the benchmark suite. What's more, two-element tuples make up about two-thirds of all unpackings (though I actually suspect it's even higher, since the unpack_sequence benchmark is definitely skewing the results towards 10-element lists and tuples).

    These specializations are trivial to implement and result in a solid 1% improvement overall.

    @brandtbucher brandtbucher added the 3.11 only security fixes label Feb 10, 2022
    @brandtbucher brandtbucher self-assigned this Feb 10, 2022
    @brandtbucher brandtbucher added interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage labels Feb 10, 2022
    @brandtbucher
    Copy link
    Member Author

    (I also plan on looking into an adaptive super-duper-instruction for UNPACK_SEQUENCE_TWO_TUPLE__STORE_FAST__STORE_FAST after the current PR has landed).

    @brandtbucher
    Copy link
    Member Author

    New changeset a9da085 by Brandt Bucher in branch 'main':
    bpo-46702: Specialize UNPACK_SEQUENCE (GH-31240)
    a9da085

    @brandtbucher
    Copy link
    Member Author

    Closing as UNPACK_SEQUENCE_TWO_TUPLE__STORE_FAST__STORE_FAST results in lots of hits, but no performance improvement.

    @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

    1 participant