drewnoakes / metadata-extractor-dotnet

Extracts Exif, IPTC, XMP, ICC and other metadata from image, video and audio files
Other
915 stars 158 forks source link

TIFF extraction makes fewer, larger reads #408

Closed drewnoakes closed 5 months ago

drewnoakes commented 5 months ago

Previously we would read values one-at-a-time through IFD tables of TIFF data. There's a fair amount of indirection here.

With this code, we load the entire IFD table into a span (ideally on the stack) and read through it from there. This was identified in traces as a nice perf win.

As part of this work, constants were added to indicate the sizes involved, and some variable names were made clearer.

Also, the size restriction placed on IFDs was improved, so that they aren't required to have space at the end for the optional follower IFD pointer, fixing some cases in the regression suite.