Skip to content

Code run with cProfile performance regression in 3.11 #93381

Closed

Description

@Fidget-Spinner

See this discussion on Discourse.

We could speed up cProfile a few ways. I'll try to work on a few PRs. We first need to find out why cProfile is so slow. I'm not sure if we can backport fixes. Though a 1.6x slowdown seems pretty significant.

Activity

  1. Fidget-Spinner commented on May 31, 2022

    @Fidget-Spinner
    MemberAuthor

    An update: I can reproduce the results that OP posted for his application. That is:

    3.10 with cProfile:
    Time Elapsed: 3.6727186999924015
    
    3.11 with cProfile:
    Time Elapsed: 6.189334200011217
    

    Without cProfile, there's a 10-20% speedup over 3.10.

    python main.py -n 500
    
    3.10 without cProfile:
    Time Elapsed: 15.240909200001624
    
    3.11 without cProfile:
    Time Elapsed: 12.682664599997224
    
  2. changed the title [-]cProfile performance regression in 3.11[/-] [+]Code run with cProfile performance regression in 3.11[/+] on May 31, 2022
  3. Fidget-Spinner commented on May 31, 2022

    @Fidget-Spinner
    MemberAuthor

    Another update: between python 3.10 and 3.11, test_cprofile didn't slow down at all (in fact, it sped up slightly). That likely indicates that cprofile itself didn't slow down, it's likely the impact of tracing code went up instead.

  4. Fidget-Spinner commented on Jul 14, 2022

    @Fidget-Spinner
    MemberAuthor

    This was mostly fixed in #93516. The next release (3.11b4) will have all the fixes included.

    3.10 profiler.py
    Time Elapsed: 2.1907681000002412
    
    3.11b4 profiler.py
    Time Elapsed: 2.4747707999995328
    
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

    performancePerformance or resource usagetype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions