2016.01.25 18:25 "[Tiff] OpenMP enabled libtiff", by Aaron Boxer

2016.01.27 18:32 "Re: [Tiff] OpenMP enabled libtiff", by Aaron Boxer

On Tue, Jan 26, 2016 at 3:36 PM, Bob Friesenhahn < bfriesen@simple.dallas.tx.us> wrote:

On Tue, 26 Jan 2016, Aaron Boxer wrote:

>> By the way, since libtiff uses memory mapped files as default,

using multiple handles isn't that bad, because the handles will all access the same memory mapping, at least on unices.

Memory mapping is great if you plan to read the file more than once but if you plan to read the file just once, then it may impose a significant penalty. This is particularly true of the file is accessed over a network file system.

Often, there is no need to read the data more than once so using memory mapping wastes memory and may break the operating system's sequential access / read-ahead detection. It is likely that the (smart) operating system knows about file handles and tries to deduce the current behavior (e.g. sequential vs random access) of each file handle so as to know if or how much read-ahead should be done. TIFF is a strange format since it requires both sequential and random access behavior, unless one uses multiple file descriptors and the data is nicely ordered. Using multiple file descriptors (one to access IFDs and the other to read strip/tile data) may offer significant performance benefits.

Thanks, Bob. So, are you saying that as TIFF is currently designed, memory mapping is beneficial? Because of the random access? This was my experience on windows: turning off memory mapping when using libtiff degraded performance.

My other question is: why is unix and windows treated differently in tifflib? mmap call allows sharing of mapping between different file handles, while on windows this is turned off. I think it would be nice to have on windows.

Cheers,
Aaron

>

>
> Bob
> --
> Bob Friesenhahn
> bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
> GraphicsMagick Maintainer, http://www.GraphicsMagick.org/

>