gh-125997: suggest efficient alternatives for `time.sleep(0)` by picnixz · Pull Request #128752 · python/cpython
-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
Conversation
The implementation of `time.sleep()` changed in Python 3.11 and relies on `clock_nanosleep()` or `nanosleep()` since then. This introduced a regression in code using `time.sleep(0)` for a syscall "no-op", polling or momentarily suspending the caller's thread. To alleviate the performance regression, we suggest some alternatives depending on the caller's needs.
picnixz
deleted the
doc/time/sleep-125997
branch
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request
…ythonGH-128752) (cherry picked from commit f4afaa6) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters