New submission from Antoine Pitrou:

It should be possible to optimize threading.Event.wait() to not acquire the 
condition when the event is already set. Patch attached.

Without patch:

$ ./python -m timeit -s "import threading; e = threading.Event(); e.set()" 
"e.wait()"
1000000 loops, best of 3: 0.466 usec per loop

With patch:

$ ./python -m timeit -s "import threading; e = threading.Event(); e.set()" 
"e.wait()"
10000000 loops, best of 3: 0.19 usec per loop

----------
components: Library (Lib)
files: event_wait.patch
keywords: patch
messages: 183811
nosy: neologix, pitrou, sbt
priority: normal
severity: normal
stage: patch review
status: open
title: Optimize Event.wait()
type: performance
versions: Python 3.4
Added file: http://bugs.python.org/file29355/event_wait.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17389>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to