This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author glangford
Recipients bquinlan, glangford, pitrou, vstinner
Date 2014-02-05.02:56:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1391569015.82.0.789033083368.issue20516@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2014-02-05 02:56:56glangfordsetrecipients: + glangford, bquinlan, pitrou, vstinner
2014-02-05 02:56:55glangfordsetmessageid: <1391569015.82.0.789033083368.issue20516@psf.upfronthosting.co.za>
2014-02-05 02:56:55glangfordlinkissue20516 messages
2014-02-05 02:56:55glangfordcreate