-
-
Notifications
You must be signed in to change notification settings - Fork 34.1k
Open
Labels
performancePerformance or resource usagePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
The below example completes in 6s for me with python2.7, but takes 21s for me in python3 . As of yet, I have not found any workaround to speed it up in python3.
import os, threading
lock = threading.Lock()
event = threading.Event()
def worker():
for ct in range(4000):
while not event.is_set():
event.wait(1)
with lock:
event.clear()
def test():
thread = threading.Thread(target=worker)
thread.start()
while thread.is_alive():
with lock:
event.set()
test()Your environment
- CPython versions tested on:
- 2.7.5
- 3.10.11
- Operating system and architecture:
- Red Hat Enterprise Linux 7 x86_64
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
performancePerformance or resource usagePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error