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

Speed up bytearray creation from list and tuple #91149

Closed
kumaraditya303 opened this issue Mar 12, 2022 · 2 comments
Closed

Speed up bytearray creation from list and tuple #91149

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

Comments

@kumaraditya303
Copy link
Contributor

BPO 46993
Nosy @gvanrossum, @asvetlov, @kumaraditya303
PRs
  • bpo-46993: Speed up bytearray creation from list and tuple #31834
  • 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 2022-03-15.14:49:22.422>
    created_at = <Date 2022-03-12.09:40:17.081>
    labels = ['interpreter-core', '3.11', 'performance']
    title = 'Speed up bytearray creation from list and tuple'
    updated_at = <Date 2022-03-15.14:49:22.422>
    user = 'https://github.com/kumaraditya303'

    bugs.python.org fields:

    activity = <Date 2022-03-15.14:49:22.422>
    actor = 'asvetlov'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-03-15.14:49:22.422>
    closer = 'asvetlov'
    components = ['Interpreter Core']
    creation = <Date 2022-03-12.09:40:17.081>
    creator = 'kumaraditya'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46993
    keywords = []
    message_count = 2.0
    messages = ['414987', '415244']
    nosy_count = 3.0
    nosy_names = ['gvanrossum', 'asvetlov', 'kumaraditya']
    pr_nums = ['31834']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue46993'
    versions = ['Python 3.11']

    @kumaraditya303
    Copy link
    Contributor Author

    The attached PR speeds up bytearray creation from list and tuple.

    Benchmark (uses pyperf):
    -----------------------------------------------------

    import pyperf
    
    runner = pyperf.Runner()
    runner.timeit(name="bench bytearray",
                  stmt="bytearray([42]*10000)",)

    Results:

    -----------------------------------------------------
    Mean +- std dev: [base] 74.8 us +- 5.5 us -> [patch] 53.2 us +- 3.3 us: 1.41x faster
    -----------------------------------------------------

    @kumaraditya303 kumaraditya303 added 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage labels Mar 12, 2022
    @asvetlov
    Copy link
    Contributor

    New changeset 6dfe09f by Kumar Aditya in branch 'main':
    bpo-46993: Speed up bytearray creation from list and tuple (GH-31834)
    6dfe09f

    @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