-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
sys.settrace dramatic slowdown in 3.12 #107674
Comments
This issue can be seen starting from the commit 411b169 with usual numpy-1.25.2. |
cc. @markshannon |
…events (pythonGH-107780) (cherry picked from commit 37d8b90) Co-authored-by: Mark Shannon <[email protected]>
@markshannon Is there any news about this? |
@iritkatriel perhaps you have some idea? |
Did #107780 help? |
@gaogaotiantian Thanks. I tried #114986, and it didn't run faster. I used the https://github.com/Quansight-Labs/ndindex repo test suite: I wish I had better news. |
Oh, did you test it with an empty trace function? |
I will do more tests, but the ultimate goal is to perform better in real-world scenarios. Here is more data from a subset of the test suite (
|
Thank you for the test. Yes the PR only improves the performance of the actual trace function - which is normally the major cost for tracing tools. Good to know it helps with the more real-life benchmark. Unfortunately, due to the change of the tracing mechanism, the overhead for |
Now that the eval_breaker is part of the thread state, here's an alternative approach that might work.
If the code and global versions differ do the following:
I think this is correct, but I've not drawn up a full state diagram. |
#114986 caused refleaks tests ( |
…nGH-114986)" This reverts commit 0a61e23.
Performance improvements in any future version would be great. That said, it is conceivable to me that generating very large Python files will become a library anti-pattern due to this. |
I came up with a patch to fix the long dict issue. I'm not sure if you are interested in trying the patch in #118127. If you are, let me know the result. |
* Check tracing in RESUME_CHECK * Only change to RESUME_CHECK if not tracing
Use PEP669's sys.monitoring for faster coverage analysis on GitHub Actions, if available. This also fixes a significant regression in coverage analysis on Python 3.12. Related issue: python/cpython#107674 .
* Check tracing in RESUME_CHECK * Only change to RESUME_CHECK if not tracing
Use PEP669's sys.monitoring for faster coverage analysis on GitHub Actions, if available. This also fixes a significant regression in coverage analysis on Python 3.12. Related issue: python/cpython#107674 .
Python 3.12 has a significant regression in coverage analysis. Related issue: python/cpython#107674 . This patch replaces coverage with a custom framework built using `sys.monitoring`, which is only available as of Python 3.12.
Python 3.12 has a significant regression in coverage analysis. Related issue: python/cpython#107674 . This patch replaces coverage with a custom framework built using `sys.monitoring`, which is only available as of Python 3.12.
Python 3.12 has a significant regression in coverage analysis. Related issue: python/cpython#107674 . This patch replaces coverage with a custom framework built using `sys.monitoring`, which is only available as of Python 3.12.
Python 3.12 has a significant regression in coverage analysis. Related issue: python/cpython#107674 . This patch replaces coverage with a custom framework built using `sys.monitoring`, which is only available as of Python 3.12.
Python 3.12 has a significant regression in coverage analysis. Related issue: python/cpython#107674 . This patch replaces coverage with a custom framework built using `sys.monitoring`, which is only available as of Python 3.12.
Python 3.12 has a significant regression in coverage analysis. Related issue: python/cpython#107674 . This patch replaces coverage with a custom framework built using `sys.monitoring`, which is only available as of Python 3.12.
Python 3.12 has a significant regression in coverage analysis. Related issue: python/cpython#107674 . This patch replaces coverage with a custom framework built using `sys.monitoring`, which is only available as of Python 3.12.
Python 3.12 has a significant regression in coverage analysis. Related issue: python/cpython#107674 . This patch replaces coverage with a custom framework built using `sys.monitoring`, which is only available as of Python 3.12.
Python 3.12 has a significant regression in coverage analysis. Related issue: python/cpython#107674 . This PR replaces coverage with a custom framework built using `sys.monitoring`, which is only available as of Python 3.12.
Hi @nedbat , do you have a chance to test the performance of coverage on 3.13b against 3.12? I made a few optimizations and I'd hope the performance issue is relieved a bit. |
I'm having a hard time re-creating the scenarios I used before :( |
That's okay. Does coveragepy have nightly validations for 3.13b? Is there a basic timing benchmark that we can refer to? Just a ballpark would be helpful. |
You can try running the ndindex tests, which was the original thing I noticed this issue with in nedbat/coveragepy#1665. Just clone
then install the packages in
(coverage is enabled automatically). On my computer with Python 3.11.9, the tests take 2:48 and with Python 3.12.0 they take 4:21 (both with coverage 7.5.2). If you want to run the tests with coverage disabled you should remove the coverage options from |
Coverage.py has an overnight job that runs its test suite on nightly builds of Python, including 3.13 and 3.14 now: https://github.com/nedbat/coveragepy/actions/runs/9265205433 There isn't a timing test in there though. |
I have a benchmarking framework, but it's fragile. I will try to patch it up later this week. |
I ran benchmarks again on 3.11, 3.12, and 3.13:
The specific versions were the newly released 3.11.10, 3.12.6, and 3.13.0rc2. The test suites were run three times, and the median time used. |
Thanks @nedbat . I'm a bit surprised that on some cases 3.13 is slower than 3.12 - I did not think of anything that we did to slow down the tracing. Glad to see we had some significant improvements on certain cases. |
Bug report
Checklist
A clear and concise description of the bug
A bug report in coverage (nedbat/coveragepy#1665) is reduced here to a pure do-nothing trace function for sys.settrace.
Reproduction:
I don't know if the unusual numpy build has something to do with this.
Linked PRs
sys.settrace
line events #107780sys.settrace
line events (GH-107780) #107841sys.settrace
#114986sys.settrace
#117133The text was updated successfully, but these errors were encountered: