Closed
Description
Bug report
Bug description:
the following script runs 100x slower on python 3.11 and python 3.12:
# relax.py
import time
def main():
for _ in range(1_000_000):
time.sleep(0.0)
main()
~ $ time python3.10 relax.py
real 0m0.643s
user 0m0.345s
sys 0m0.314s
~ $ time python3.11 relax.py
real 0m52.212s
user 0m0.744s
sys 0m1.115s
~ $ time python3.12 relax.py
real 0m52.826s
user 0m1.317s
sys 0m0.997s
here is my system+python information:
~ $ uname -r
5.15.0-122-generic
~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy
~ $ python3.10 -VV
Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0]
~ $ python3.11 -VV
Python 3.11.10 (main, Sep 7 2024, 18:35:41) [GCC 11.4.0]
~ $ python3.12 -VV
Python 3.12.7 (main, Oct 1 2024, 08:52:12) [GCC 11.4.0]
CPython versions tested on:
3.10, 3.11, 3.12, 3.13
Operating systems tested on:
Linux
Linked PRs
- gh-125997: ensure that
time.sleep(0)
is not delayed on non-Windows platforms #128274 (abandoned proposal) - gh-125997: improve tests for
time.sleep()
#128751 - [3.12] gh-125997: Increase test coverage for
time.sleep()
(GH-128751) #128795 - [3.13] gh-125997: Increase test coverage for
time.sleep()
(GH-128751) #128796 - gh-125997: suggest efficient alternatives for
time.sleep(0)
#128752 - [3.13] gh-125997: suggest efficient alternatives for
time.sleep(0)
(GH-128752) #128984 - [3.12] gh-125997: suggest efficient alternatives for
time.sleep(0)
(GH-128752) #128985
Resolution: #125997 (comment)
Metadata
Metadata
Assignees
Labels
C modules in the Modules dirC modules in the Modules dirPerformance or resource usagePerformance or resource usageAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error