New submission from Glenn Langford:

The current approach taken in as_completed() and wait() is to immediately lock 
the entire set of given Futures simultaneously. This limits concurrency, 
particularly when the number of futures is large, and also requires the 
complete set of Futures to be known up front.

A different approach is to lock Futures one at a time, as they are given. In 
the case of as_completed(), completed futures can be yielded immediately. For 
completed futures, a waiter also does not have to be installed (whereas the 
current implementation installs waiters for all given Futures, regardless of 
state).

A demonstration patch is attached which 
- locks Futures one at a time for as_completed() and all variations of wait()
- reduces the overhead in tracking the state of each Future
- makes it easier to add other user APIs if desired later
- consolidates the machinery into a new internal class, reducing the amount of 
code

----------
components: Library (Lib)
files: futures-base.patch
keywords: patch
messages: 210286
nosy: bquinlan, glangford, haypo, pitrou
priority: normal
severity: normal
status: open
title: Concurrent.futures base concurrency improvement (with patch)
type: enhancement
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file33920/futures-base.patch

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

Reply via email to