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

Improve performance of sys.settracing based tools. #90081

Open
markshannon opened this issue Nov 29, 2021 · 7 comments
Open

Improve performance of sys.settracing based tools. #90081

markshannon opened this issue Nov 29, 2021 · 7 comments
Assignees
Labels
3.11 only security fixes 3.12 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@markshannon
Copy link
Member

BPO 45923
Nosy @nedbat, @markshannon, @pablogsal, @brandtbucher
PRs
  • bpo-45923: Handle call events in bytecode #30364
  • bpo-45923: Add RESUME_QUICK #31244
  • bpo-45923: Decouple suspension of tracing from tracing flag. #31908
  • 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/markshannon'
    closed_at = None
    created_at = <Date 2021-11-29.11:37:57.908>
    labels = ['interpreter-core', '3.11', 'performance']
    title = 'Improve performance of sys.settracing based tools.'
    updated_at = <Date 2022-03-15.17:06:49.934>
    user = 'https://github.com/markshannon'

    bugs.python.org fields:

    activity = <Date 2022-03-15.17:06:49.934>
    actor = 'Mark.Shannon'
    assignee = 'Mark.Shannon'
    closed = False
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2021-11-29.11:37:57.908>
    creator = 'Mark.Shannon'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45923
    keywords = ['patch']
    message_count = 4.0
    messages = ['407263', '409842', '413017', '415267']
    nosy_count = 4.0
    nosy_names = ['nedbat', 'Mark.Shannon', 'pablogsal', 'brandtbucher']
    pr_nums = ['30364', '31244', '31908']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue45923'
    versions = ['Python 3.11']

    @markshannon
    Copy link
    Member Author

    In our quest for performance, the performance of sys.settracing based tools has probably gotten worse.

    1. How do we measure this?
    2. How do fix this?

    We will initially use coverage.py as proxy for all sys.settracing based tools when measuring performance.

    The fix is probably to use quickening to insert a minimum set of instrumentation instructions required for tracing/profiling.
    The existence of f_trace_opcode is a bit of a problem however, as we will have to instrument every instruction.

    Ideally, sys.settracing based tools should be faster on 3.11 than 3.10, but at the least we should provide a simple alternative to sys.settracing that is faster.

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

    New changeset e028ae9 by Mark Shannon in branch 'main':
    bpo-45923: Handle call events in bytecode (GH-30364)
    e028ae9

    @markshannon
    Copy link
    Member Author

    New changeset d7a5aca by Brandt Bucher in branch 'main':
    bpo-45923: Add RESUME_QUICK (GH-31244)
    d7a5aca

    @markshannon
    Copy link
    Member Author

    New changeset 099f756 by Mark Shannon in branch 'main':
    bpo-45923: Decouple suspension of tracing from tracing flag. (GH-31908)
    099f756

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @neonene
    Copy link
    Contributor

    neonene commented Jun 8, 2022

    Maybe this does not matter, but the pure python tracer of coverage.py has slowed down since 099f756:

    pyperformance before 099f756
    coverage 684 ms 1.17 sec (171% ) Windows

    @markshannon
    Copy link
    Member Author

    It doesn't matter as much as the performance of coverage.py C tracer, but it is still worth investigating.

    @nedbat
    Copy link
    Member

    nedbat commented Jun 12, 2022

    There have been some recent improvements in coverage.py for the Python tracing, which might compensate.

    miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jul 28, 2022
    (cherry picked from commit b8b2990)
    
    Co-authored-by: Mark Shannon <mark@hotpy.org>
    pablogsal pushed a commit that referenced this issue Jul 29, 2022
    (cherry picked from commit b8b2990)
    
    Co-authored-by: Mark Shannon <mark@hotpy.org>
    
    Co-authored-by: Mark Shannon <mark@hotpy.org>
    @iritkatriel iritkatriel added the 3.12 bugs and security fixes label Sep 13, 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 3.12 bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants