Subject: Re: [boost] [afio] Formal review of Boost.AFIO
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2015-08-31 12:53:31
On 31 Aug 2015 at 16:50, Thomas Heller 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.
> How does this answer my question?
Well, you asked:
> >> Is this really an assumption that holds when dealing with
> >> that do file I/O? I have a hard time believing this is the
I assumed you didn't want me to simply say "accept it's true", so I
tried to explain how even a simple operation outside AFIO may turn
into multiple promise future constructions and additions of
None of those get wait() called on them, and therefore you very
rarely block. As an example, if you executed 1000 promise + future +
continuations but blocked on just one of those, my condition
"future.wait() very rarely blocks in your use scenario" is fulfilled
by virtue that future.wait() is simply never called.
-- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk