Issue Bug Closed

#21269md5_file() to check if a file has been changed is very expensive [performance]

Martin Holtz 10/14/09, 10:41 updated 02/11/11, 11:04

Description

i am generating thumbnails from very large images. I thought, after rendering once, it should not be an performance issue anymore.

But with every new page creation, there is a md5_file() check, if the file has been changed. That is a nice feature – which takes 300-500ms for a 40MB file – with 20 thumbnails the page generation takes about 10 seconds.

There was a discussion about that on the performance newsgroup with the conclusion, that a flag to use only mtime would be a great enhancement.

Joey Hasenau and Martin Kutschker wrote that pseudocode, which should be ok, to handle that issue:

t3lib/class.t3lib_stdgraphic.php -> getCachedImageDimensions($imageFile)

if (size changed) { // any size change, means content change
make new image
} else {
if (mtime changed) { // mtime change, could mean content change
// make md5 test only, if mtime is not enough for you
if (noContentCheckFlag set || content changed)
make new image
}
}
}

it would introduce a new flag to disable the md5_file() check – only mtime would has been used than.

Additional informations:

http://lists.typo3.org/pipermail/typo3-performance/2009-September/000264.html
http://lists.typo3.org/pipermail/typo3-performance/2009-September/000277.html
(issue imported from #M12232)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.