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

Code run with cProfile performance regression in 3.11 #93381

Closed
Fidget-Spinner opened this issue May 31, 2022 · 3 comments
Closed

Code run with cProfile performance regression in 3.11 #93381

Fidget-Spinner opened this issue May 31, 2022 · 3 comments
Labels
performance Performance or resource usage type-feature A feature request or enhancement

Comments

@Fidget-Spinner
Copy link
Member

Fidget-Spinner commented May 31, 2022

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.

@Fidget-Spinner Fidget-Spinner added the type-feature A feature request or enhancement label May 31, 2022
@hugovk hugovk added the performance Performance or resource usage label May 31, 2022
@Fidget-Spinner
Copy link
Member Author

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

@Fidget-Spinner Fidget-Spinner changed the title cProfile performance regression in 3.11 Code run with cProfile performance regression in 3.11 May 31, 2022
@Fidget-Spinner
Copy link
Member Author

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.

@Fidget-Spinner
Copy link
Member Author

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
Labels
performance Performance or resource usage type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants