You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Speedup macOS free-threading slowest tests test_signal and test_asyncio.test_free_threading #162364
A lot of that comes from two tests currently which we can make faster with some small adjustments.
test_signal (22-27 minutes)
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.
We 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.
This 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
test_asyncio.test_free_threading (~11 minutes)
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.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Activity
pythongh-162364: Clarify why test_signal waits for signal handlers
gh-162364: Speed up test_signal StressTest.test_stress_delivery_simul…
[3.15] gh-162364: Speed up test_signal StressTest.test_stress_deliver…
[3.14] gh-162364: Speed up test_signal StressTest.test_stress_deliver…