Skip to content

Implement free-list for single-digit longs #70529

Closed

Description

@1st1
BPO 26341
Nosy @mdickinson, @vstinner, @serhiy-storchaka, @1st1
Superseder
  • bpo-24165: Free list for single-digits ints
  • Files
  • long_fl.patch
  • 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/1st1'
    closed_at = <Date 2016-02-11.20:09:40.568>
    created_at = <Date 2016-02-11.19:22:36.712>
    labels = ['interpreter-core', 'performance']
    title = 'Implement free-list for single-digit longs'
    updated_at = <Date 2016-02-11.20:09:40.567>
    user = 'https://github.com/1st1'

    bugs.python.org fields:

    activity = <Date 2016-02-11.20:09:40.567>
    actor = 'yselivanov'
    assignee = 'yselivanov'
    closed = True
    closed_date = <Date 2016-02-11.20:09:40.568>
    closer = 'yselivanov'
    components = ['Interpreter Core']
    creation = <Date 2016-02-11.19:22:36.712>
    creator = 'yselivanov'
    dependencies = []
    files = ['41900']
    hgrepos = []
    issue_num = 26341
    keywords = ['patch']
    message_count = 3.0
    messages = ['260124', '260125', '260127']
    nosy_count = 4.0
    nosy_names = ['mark.dickinson', 'vstinner', 'serhiy.storchaka', 'yselivanov']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '24165'
    type = 'performance'
    url = 'https://bugs.python.org/issue26341'
    versions = ['Python 3.6']

    Activity

    1. 1st1 commented on Feb 11, 2016

      @1st1
      MemberAuthor

      The attached patch implements a free-list for single-digit longs. We already have free lists for many fundamental types, such as floats & unicode.

      The patch improves performance in micro-benchmarks by 10-20%. It'll also lessen memory fragmentation issues.

      == Benchmarks ==

      ### spectral_norm ###
      Min: 0.268018 -> 0.245042: 1.09x faster
      Avg: 0.289548 -> 0.257861: 1.12x faster
      Significant (t=18.82)
      Stddev: 0.01004 -> 0.00640: 1.5680x smaller

      -m timeit -s "loops=tuple(range(1000))" "for x in loops: x+x"
      with patch: 34.5 usec without patch: 45.9 usec

      == Why only single-digit? ==

      I've also a patch that implements free-lists for 1-digit, 2-digits and 3-digits longs, and collects statistics on them. It looks like we only want to optimize 1-digit longs:

      • 2to3 benchmark (the first number is the number of all N-digit longs, the second number is the number of longs created via free-list):

      ===> d1_longs = 142384 124759
      ===> d2_longs = 6872 6264
      ===> d3_longs = 2907 2834

      • richards:
        ===> d1_longs = 219630 219033
        ===> d2_longs = 1455 1096
        ===> d3_longs = 630 627

      • spectral_norm:
        ===> d1_longs = 133928432 133927838
        ===> d2_longs = 1471 1113
        ===> d3_longs = 630 627

    2. self-assigned this
      on Feb 11, 2016
    3. added
      interpreter-core(Objects, Python, Grammar, and Parser dirs)
      performancePerformance or resource usage
      on Feb 11, 2016
    4. serhiy-storchaka commented on Feb 11, 2016

      @serhiy-storchaka
      Member

      This looks as a duplicate of bpo-24165.

    5. 1st1 commented on Feb 11, 2016

      @1st1
      MemberAuthor

      You're right Serhiy, closing this one.

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

    Labels

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