Skip to content

Speed up bytearray creation from list and tuple #91149

Description

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

    Activity

    1. kumaraditya303 commented on Mar 12, 2022

      @kumaraditya303
      ContributorAuthor

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

    2. asvetlov commented on Mar 15, 2022

      @asvetlov
      Contributor

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

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

      3.11only security fixesinterpreter-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