TIFFReadEncodedStrip/TIFFSwabArrayOfShort is slower in libtiff v4.6.0 as compared to v4.5.0
Summary:
We have switched our application from using libtiff v4.5.0 to v4.6.0. However, for a specific file (huge ~565 MB) we see regressions in reading the file. Since it is a big file with confidential data so I couldn't provide the file but I have added some properties of the file below:
FileSize: 589028989
Format: 'tif'
Width: 8703
Height: 8417
BitDepth: 64
ColorType: 'truecolor'
FormatSignature: [77 77 0 42]
ByteOrder: 'big-endian'
NewSubFileType: 0
BitsPerSample: [16 16 16 16]
Compression: 'Uncompressed'
PhotometricInterpretation: 'RGB'
SamplesPerPixel: 4
RowsPerStrip: 60
Note that the regression numbers for another uint16 file, which is much smaller in size, are very small and barely noticeable. I profiled the code in case of regressions and found out that TIFFReadEncodedStrip calls TIFFSwabArrayOfShort function which is much slower in v4.6.0 (146 ms) as compared to v4.5.0 (94ms). I believe these numbers have become more prominent because of the size of the Tiff file. Please note that I could see this regression only on macOS platform. Can you please confirm that it is an issue in libtiff v4.6.0?
Version v4.6.0
Steps to reproduce
I have attached the C++ code but unfortunately cannot share the TIFF file because of confidential data in the file.
Output in v4.5.0: NumStrips = 564 Size of strip = 1044360 Rows per strip = 60 Execution time = 310 milliseconds
Output in v4.6.0 NumStrips = 564 Size of strip = 1044360 Rows per strip = 60 Execution time = 354 milliseconds
Platform macOS - 64bit