Title: Speedup macOS free-threading slowest tests test_signal and test_asyncio.test_free_threading · Issue #162364 · python/cpython · GitHub
Open Graph Title: Speedup macOS free-threading slowest tests test_signal and test_asyncio.test_free_threading · Issue #162364 · python/cpython
X Title: Speedup macOS free-threading slowest tests test_signal and test_asyncio.test_free_threading · Issue #162364 · python/cpython
Description: Feature or enhancement ARM64 MacOS M1 Refleaks NoGIL 3.x currently takes 25-49 minutes per build. A lot of that comes from two tests currently which we can make faster with some small adjustments. test_signal (22-27 minutes) StressTest.t...
Open Graph Description: Feature or enhancement ARM64 MacOS M1 Refleaks NoGIL 3.x currently takes 25-49 minutes per build. A lot of that comes from two tests currently which we can make faster with some small adjustments. ...
X Description: Feature or enhancement ARM64 MacOS M1 Refleaks NoGIL 3.x currently takes 25-49 minutes per build. A lot of that comes from two tests currently which we can make faster with some small adjustments. ...
Opengraph URL: https://github.com/python/cpython/issues/162364
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Speedup macOS free-threading slowest tests test_signal and test_asyncio.test_free_threading","articleBody":"### Feature or enhancement\n\n[`ARM64 MacOS M1 Refleaks NoGIL 3.x `](https://buildbot.python.org/#/builders/1368) currently takes 25-49 minutes per build.\n\nA lot of that comes from two tests currently which we can make faster with some small adjustments.\n\n## test_signal (22-27 minutes)\n\n`StressTest.test_stress_delivery_simultaneous` is most of this time. The test sends a pair of signals 5000 times and waits for each pair to arrive. Since gh-93770, the wait uses support.sleeping_retry(), which sleeps at least 10 ms whenever the signals haven't arrived at the first check. The signals actually arrive within tens of microseconds, so almost all of the test's runtime is spent in those 10 ms sleeps.\n\nWe can move to the same code as `test_stress_delivery_dependent` which runs much faster. already waits with a 10 µs poll against an overall SHORT_TIMEOUT deadline. The proposed fix uses that same polling code (moved into a shared helper) in both tests.\n\nThis is particularly slow because the buildbot is run as a macOS background task (`taskpolicy -b`) which ends up causing the 10ms sleep to often stretch to 60–100 ms\n\n## test_asyncio.test_free_threading (~11 minutes)\n\n`test_unregister_lingering_tasks_of_exited_thread` is a regression test added for gh-159449. With the C implementation, it takes about 12 s per run (about 0.15 s with the pure-Python one). Currently this happens a lot of times in a loop. The same bug can be caught reliably with a lot less iterations.\n\n### Has this already been discussed elsewhere?\n\nThis is a minor feature, which does not need previous discussion elsewhere\n\n### Links to previous discussion of this feature:\n\n_No response_\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-162366\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/cmaloney","@type":"Person","name":"cmaloney"},"datePublished":"2026-11-21T07:48:00Z","url":"https://github.com/python/cpython/issues/162364"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:8b2174a6-a60b-b43f-f4b4-782b89bf0e00 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B9BA:16AB79:36264C7:44DD89A:6B01E939 |
| html-safe-nonce | b8b599f03d6f020932a647837371cda25811f3ce9d3afaf2d1510cefe16ab822 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOUJBOjE2QUI3OTozNjI2NEM3OjQ0REQ4OUE6NkIwMUU5MzkiLCJ2aXNpdG9yX2lkIjoiNTg5NzM1MjQ5MTM2Mzg1NDY0OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5f115c02971fb9b6d2398b828883a75e35aafa244ecffbf73b61ed1c2b9f6a2e |
| hovercard-subject-tag | issue:6526198604 |
| 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/162364/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cd63d2fae148378067184261fc5d5821315e4435e1def439de2282ce9ea650f0/python/cpython/issues/162364 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cd63d2fae148378067184261fc5d5821315e4435e1def439de2282ce9ea650f0/python/cpython/issues/162364 |
| og:image:alt | Feature or enhancement ARM64 MacOS M1 Refleaks NoGIL 3.x currently takes 25-49 minutes per build. A lot of that comes from two tests currently which we can make faster with some small adjustments. ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | cmaloney |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width