Skip to content

Set QImageReader format explicitly to avoid expensive probing

Stefan Brüns requested to merge work/bruns/imagereader_setformat_svg into master

QImageReader::canRead will do fairly expensive probing based on the content when passed a buffer instead of a file/filename. This is mostly noticeable with the KImageFormats LibRAW (kimg_raw) plugin, which creates a huge LibRAW class instance on each canRead call.

With the change, the canRead performance itself is almost doubled, the cost of createIconImage is reduced by about 20% for typical SVG icons, according to valgrind.

Merge request reports