Title: sys.settrace dramatic slowdown in 3.12 · Issue #107674 · python/cpython · GitHub
Open Graph Title: sys.settrace dramatic slowdown in 3.12 · Issue #107674 · python/cpython
X Title: sys.settrace dramatic slowdown in 3.12 · Issue #107674 · python/cpython
Description: Bug report Checklist I am confident this is a bug in CPython, not a bug in a third-party project I have searched the CPython issue tracker, and am confident this bug has not been reported before A clear and concise description of the bug...
Open Graph Description: Bug report Checklist I am confident this is a bug in CPython, not a bug in a third-party project I have searched the CPython issue tracker, and am confident this bug has not been reported before A ...
X Description: Bug report Checklist I am confident this is a bug in CPython, not a bug in a third-party project I have searched the CPython issue tracker, and am confident this bug has not been reported before A ...
Opengraph URL: https://github.com/python/cpython/issues/107674
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"sys.settrace dramatic slowdown in 3.12","articleBody":"# Bug report\r\n\r\n## Checklist\r\n\r\n- [x] I am confident this is a bug in CPython, not a bug in a third-party project\r\n- [x] I have searched the CPython issue tracker, and am confident this bug has not been reported before\r\n\r\n## A clear and concise description of the bug\r\n\r\nA bug report in coverage (https://github.com/nedbat/coveragepy/issues/1665) is reduced here to a pure do-nothing trace function for sys.settrace.\r\n\r\nReproduction:\r\n\r\n```\r\n% git clone https://github.com/nedbat/ndindex\r\n\r\n% cd ndindex\r\n\r\n% python3.11 -VV\r\nPython 3.11.4 (main, Jun 7 2023, 08:42:37) [Clang 14.0.3 (clang-1403.0.22.14.1)]\r\n\r\n% python3.11 -m venv v311\r\n\r\n% ./v311/bin/pip install numpy\r\n\r\n% python3.12 -VV\r\nPython 3.12.0b4 (main, Jul 11 2023, 20:38:26) [Clang 14.0.3 (clang-1403.0.22.14.1)]\r\n\r\n% python3.12 -m venv v312\r\n\r\n% ./v312/bin/pip install --pre --extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy\r\n\r\n% # Run the code without the trace function.\r\n% for x in 1 2 3; time ./v311/bin/python -m ndindex.tests.justdoit notrace\r\n./v311/bin/python -m ndindex.tests.justdoit notrace 7.05s user 0.37s system 108% cpu 6.813 total\r\n./v311/bin/python -m ndindex.tests.justdoit notrace 7.04s user 0.34s system 109% cpu 6.724 total\r\n./v311/bin/python -m ndindex.tests.justdoit notrace 7.00s user 0.35s system 109% cpu 6.696 total\r\n\r\n% # 3.12 is slightly faster without the trace function.\r\n% for x in 1 2 3; time ./v312/bin/python -m ndindex.tests.justdoit notrace\r\n./v312/bin/python -m ndindex.tests.justdoit notrace 6.56s user 0.30s system 106% cpu 6.422 total\r\n./v312/bin/python -m ndindex.tests.justdoit notrace 6.48s user 0.31s system 106% cpu 6.359 total\r\n./v312/bin/python -m ndindex.tests.justdoit notrace 6.38s user 0.28s system 107% cpu 6.217 total\r\n\r\n% # 3.11 with tracing is about 3x slower.\r\n% for x in 1 2 3; time ./v311/bin/python -m ndindex.tests.justdoit trace\r\n./v311/bin/python -m ndindex.tests.justdoit trace 22.64s user 0.51s system 101% cpu 22.772 total\r\n./v311/bin/python -m ndindex.tests.justdoit trace 21.92s user 0.46s system 101% cpu 21.979 total\r\n./v311/bin/python -m ndindex.tests.justdoit trace 21.55s user 0.35s system 102% cpu 21.379 total\r\n\r\n% # 3.12 with tracing is 7x slower.\r\n% for x in 1 2 3; time ./v312/bin/python -m ndindex.tests.justdoit trace\r\n./v312/bin/python -m ndindex.tests.justdoit trace 49.47s user 0.40s system 100% cpu 49.676 total\r\n./v312/bin/python -m ndindex.tests.justdoit trace 49.53s user 0.39s system 100% cpu 49.784 total\r\n./v312/bin/python -m ndindex.tests.justdoit trace 50.44s user 0.38s system 100% cpu 50.739 total\r\n```\r\n\r\nI don't know if the unusual numpy build has something to do with this. \r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-107780\n* gh-107841\n* gh-114986\n* gh-117133\n* gh-117393\n* gh-118127\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/nedbat","@type":"Person","name":"nedbat"},"datePublished":"2023-08-05T22:12:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":37},"url":"https://github.com/107674/cpython/issues/107674"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:aaedaa0b-c7b9-9f7c-dc36-37d7786df262 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D79E:192D74:2D4957:3C006E:696B0410 |
| html-safe-nonce | e5cef41482178b9b65b2f1ff54ebe85c43db0f022dc645e94ccb232abd89bdd5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzlFOjE5MkQ3NDoyRDQ5NTc6M0MwMDZFOjY5NkIwNDEwIiwidmlzaXRvcl9pZCI6IjkwOTMyMzQ3MDk5NDMyMjMzMTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4526c8cbf15a430dedd81d01e503b3e105c2ff7585b33847d7d5c2dc600c3246 |
| hovercard-subject-tag | issue:1837956644 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/107674/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7aa69f34b406d74c3d83f25eb2c0d6839569b846be66c86f08d2d988e84752f2/python/cpython/issues/107674 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7aa69f34b406d74c3d83f25eb2c0d6839569b846be66c86f08d2d988e84752f2/python/cpython/issues/107674 |
| og:image:alt | Bug report Checklist I am confident this is a bug in CPython, not a bug in a third-party project I have searched the CPython issue tracker, and am confident this bug has not been reported before A ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nedbat |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width