On 31 Aug 2015 at 1:38, Thomas Heller wrote:
On 08/30/2015 10:06 PM, Niall Douglas wrote:
7. future.wait() very rarely blocks in your use scenario i.e. most if not nearly all the time the future is ready. If you are blocking, the cost of any thread sleep will always dwarf the cost of any future.
Is this really an assumption that holds when dealing with operations that do file I/O? I have a hard time believing this is the general case.
Imagine the copying of a 10Mb file in 1Mb segments. You would create a minimum of 11 future-promise pairs, and only wait on the very last one. My own benchmarking here suggested that (much) lighter weight futures would let me implement a much more efficient ASIO reactor than ASIO's and push all potential blocking to outside AFIO, perhaps right down to the final end user layer. Perhaps thousands of future-promise pairs might be created, continued from and destroyed between actual thread blocks. This is why I believe - currently without real world proof - this ought to be a big win. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/