GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add _testcapi.stack_pointer() to measure the C stack consumption · Issue #75049 · python/cpython

Add _testcapi.stack_pointer() to measure the C stack consumption #75049

New issue
Copy link
New issue
Copy link
Closed
Closed
Add _testcapi.stack_pointer() to measure the C stack consumption#75049
Copy link
Labels
3.7 (EOL)end of lifeend of life

Description

@vstinner
vstinner
opened on Jul 6, 2017
Issue body actions
BPO 30866
Nosy @vstinner, @serhiy-storchaka
PRs
  • [2.7] bpo-30866: Add _testcapi.stack_pointer() #2600
  • bpo-30866: Add _testcapi.stack_pointer() #2601
  • [3.6] bpo-30866: Add _testcapi.stack_pointer() #2602
  • [3.5] bpo-30866: Add _testcapi.stack_pointer() #2603
  • Files
  • stack_overflow-3.py
  • 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 2017-09-15.16:38:44.368>
    created_at = <Date 2017-07-06.10:51:19.887>
    labels = ['3.7']
    title = 'Add _testcapi.stack_pointer() to measure the C stack consumption'
    updated_at = <Date 2017-09-15.16:38:44.367>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2017-09-15.16:38:44.367>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-09-15.16:38:44.368>
    closer = 'vstinner'
    components = []
    creation = <Date 2017-07-06.10:51:19.887>
    creator = 'vstinner'
    dependencies = []
    files = ['46992']
    hgrepos = []
    issue_num = 30866
    keywords = []
    message_count = 6.0
    messages = ['297822', '297824', '297826', '297829', '298060', '302271']
    nosy_count = 2.0
    nosy_names = ['vstinner', 'serhiy.storchaka']
    pr_nums = ['2600', '2601', '2602', '2603']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue30866'
    versions = ['Python 3.7']

    Activity

    1. vstinner commented on Jul 6, 2017

      @vstinner
      vstinner
      on Jul 6, 2017
      MemberAuthor
      More actions

      In issues bpo-28870, bpo-29227, bpo-29233 and bpo-29234, I worked on reducing the C stack consumption. I now would to add the _testcapi.stack_pointer() that I used to be able to easily measure the stack consumption.

      Try for example attached stack_overflow-3.py to measure the maximum number of C calls before a C stack overflow. The script also computes the average stack usage per C call for a specific kind of C call.

    2. vstinner
      added
      3.7 (EOL)end of lifeend of life
      on Jul 6, 2017
    3. serhiy-storchaka commented on Jul 6, 2017

      @serhiy-storchaka
      serhiy-storchaka
      on Jul 6, 2017
      Member
      More actions

      Usually we first merge a patch in master and after that cherry-pick it to other branches.

    4. vstinner commented on Jul 6, 2017

      @vstinner
      vstinner
      on Jul 6, 2017
      MemberAuthor
      More actions

      Usually we first merge a patch in master and after that cherry-pick it to other branches.

      Right. But in this case, I needed the patch for each branch, to run the test on all branches to write a blog post :-) Here are results (blog post spoiler!):

      Table showing the C stack consumption in bytes, and the difference compared to
      Python 3.5 (last release before I started working on FASTCALL):

      ==================== ================ ===== ================ ================
      Function 2.7 3.5 3.6 3.7
      ==================== ================ ===== ================ ================
      test_python_call 1,360 (+352) 1,008 1,120 (+112) 960 (-48)
      test_python_getitem 1,408 (+288) 1,120 1,168 (+48) 880 (-240)
      test_python_iterator 1,424 (+192) 1,232 1,200 (-32) 1,024 (-208)
      Total 4,192 (+832) 3,360 3,488 (+128) 2,864 (-496)
      ==================== ================ ===== ================ ================

      Table showing the number of function calls before a stack overflow,
      and the difference compared to Python 3.5:

      ==================== =================== ====== =================== ===================
      Function 2.7 3.5 3.6 3.7
      ==================== =================== ====== =================== ===================
      test_python_call 6,161 (-2,153) 8,314 7,482 (-832) 8,729 (+415)
      test_python_getitem 5,951 (-1,531) 7,482 7,174 (-308) 9,522 (+2,040)
      test_python_iterator 5,885 (-916) 6,801 6,983 (+182) 8,184 (+1,383)
      Total 17,997 (-4600) 22,597 21,639 (-958) 26,435 (+3,838)
      ==================== =================== ====== =================== ===================

    5. vstinner commented on Jul 6, 2017

      @vstinner
      vstinner
      on Jul 6, 2017
      MemberAuthor
      More actions

      I just published my blog post: "My contributions to CPython during 2017 Q1"
      https://haypo.github.io/contrib-cpython-2017q1.html

      See the "Stack consumption" section.

    6. vstinner commented on Jul 10, 2017

      @vstinner
      vstinner
      on Jul 10, 2017
      MemberAuthor
      More actions

      New changeset 64fa449 by Victor Stinner in branch 'master':
      bpo-30866: Add _testcapi.stack_pointer() (bpo-2601)
      64fa449

    7. vstinner commented on Sep 15, 2017

      @vstinner
      vstinner
      on Sep 15, 2017
      MemberAuthor
      More actions

      I added the function to the master branch.

      I changed my mind. I now consider that the function is no needed in other branches. It can be added manually if someone needs it.

    8. vstinner
      closed this as completedon Sep 15, 2017
    9. ezio-melotti
      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.7 (EOL)end of lifeend of life

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402503 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.