Message183727
Condition variables implement a FIFO queue for waiting threads. The current implementation uses a regular Python list but could use a deque instead.
A wait() call appends a new waiter. A notify() call removes the oldest waiter; this is an O(n) operation on list but only an O(1) operation on deques. A notify_all() call is O(n**2) for a list but only O(n) for a deque.
If there is interest in this patch, I can add slicing support to collections.deque so that this patch won't need itertools.islice() |
|
Date |
User |
Action |
Args |
2013-03-08 06:16:26 | rhettinger | set | recipients:
+ rhettinger, pitrou |
2013-03-08 06:16:26 | rhettinger | set | messageid: <1362723386.92.0.340971682948.issue17385@psf.upfronthosting.co.za> |
2013-03-08 06:16:26 | rhettinger | link | issue17385 messages |
2013-03-08 06:16:26 | rhettinger | create | |
|