Is boost asio appropriate for this use case ?
I am decoding an image file: the file has tagged header info mixed with 4K pixel code blocks. Platform is primarily windows, but could be osx or linux. Once I read in a code block, I can launch (asynchronously) my decode routine on this block, while continuing to read the file for header info and code blocks. Currently, I do synchronous reads using fread(...). Is is worthwhile to switch to boost asio to asynchronously read in the code blocks? The read callback could trigger my decode routine. But I wouldn't have to wait for the read before I carry on to the next code block. If so, can anyone point me to a reference/tutorial covering boost::asio asynch reads from disk?
On 9 Jun 2014 at 15:21, Aaron Boxer wrote:
I am decoding an image file: the file has tagged header info mixed with 4K pixel code blocks.
Platform is primarily windows, but could be osx or linux.
Once I read in a code block, I can launch (asynchronously) my decode routine on this block, while continuing to read the file for header info and code blocks.
Currently, I do synchronous reads using fread(...).
Is is worthwhile to switch to boost asio to asynchronously read in the code blocks? The read callback could trigger my decode routine. But I wouldn't have to wait for the read before I carry on to the next code block.
Almost certainly not. fread() will be fairly close to optimal unless your images are in the > 100's Mb range. A memory map will be optimal though, plus on Windows a fread() turns into a memory map under the bonnet too, so a direct memory map will save a memory copy. If your images are bigger than that, or you're reading many images from many files, you definitely want proposed Boost.AFIO not ASIO.
If so, can anyone point me to a reference/tutorial covering boost::asio asynch reads from disk?
For AFIO: https://ci.nedprod.com/view/Boost.AFIO/job/Boost.AFIO%20Build%20Docume ntation/Boost.AFIO_Documentation/doc/html/afio/quickstart.html It's a brutal API, but if you need the performance that's the sacrifice. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
Niall Douglas wrote:
On 9 Jun 2014 at 15:21, Aaron Boxer wrote:
If so, can anyone point me to a reference/tutorial covering boost::asio asynch reads from disk?
For AFIO:
https://ci.nedprod.com/view/Boost.AFIO/job/Boost.AFIO%20Build%20Docume ntation/Boost.AFIO_Documentation/doc/html/afio/quickstart.html
That's 503 service unavailable for me. Guru Meditation: XID: 80284367 Pete
On 9 Jun 2014 at 22:19, Pete Bartlett wrote:
If so, can anyone point me to a reference/tutorial covering boost::asio asynch reads from disk?
For AFIO:
https://ci.nedprod.com/view/Boost.AFIO/job/Boost.AFIO%20Build%20Docume ntation/Boost.AFIO_Documentation/doc/html/afio/quickstart.html
That's 503 service unavailable for me. Guru Meditation: XID: 80284367
Argh! I've changed some settings. Hopefully better now. Thanks for telling me. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
participants (3)
-
Aaron Boxer
-
Niall Douglas
-
Pete Bartlett