Suggestion to improve performance
Hello,
I observed that Qt image plugins are created two times when viewing single image.
There are two QImageReader
s in loadingdocumentimpl.cpp
, one in bool loadMetaInfo()
and second in void loadImageData()
The first is used to determine image size (mImageSize = reader.size();
) and the second to load image data.
Calling reader.size()
only (without reading the image) is expensive operation sometimes. For some image formats it triggers decoding process. Some image formats do not have final image dimensions in header (like HEIF and AVIF), because various transformations (which include aspect, crop, rotate, mirror) are applied after image decoding.
I suggest to share same QImageReader instance in loadMetaInfo()
and loadImageData()
, it will prevent the same image to be parsed (or decompressed in some cases) two times.