[TYPO3-performance] TS-Rendering - IMG_RESOURCE - 622 ms - Solution
bernd wilke
x00nsji02 at sneakemail.com
Fri Sep 25 17:14:44 CEST 2009
Am Fri, 25 Sep 2009 14:44:18 +0200 schrieb JoH asenau:
>> the modified time is not available on windows, right? Otherwise
>> checking mtime should be ok?!
>
> At least on our 2K VBox, XP VBox and Vista Ultimate master I can see
> "Geändert" and "Erstellt" - so I guess there is a "modified time"
> available.
Windows stores time of creation, last modification and last access so
they are not all visible at the same time.
> On the other hand this might still not increase performance
> as long as the check for the file content isn't done in the second run,
> because the content might still be the same, even though the time has
> changed.
>
> So I would prefer the following concept:
>
> if (time has changed && size has changed) {
> create new image
> } else if (time has changed && content has changed) {
> create new image
> }
>
> But this is just based on 2 assumptions: 1. checking for a change of
> content will be faster than just generating a new image.
> 2. if the size is different the content can't be the same
>
> If 1. is not the case a simple check for the time should be enough.
maybe the content-check can be done in two steps:
1. check a small part of the file
2. check complete file
for pictures the first x KB are likely to change if the complete picture
changes (assuming most formats store filesize in the fist bytes)
in future we may need a similar check for movies (new media-support) and
that might be very big files.
Calculating md5 for all bytes of the whole file will take a long time.
firsth thoughts for faster checks:
- check first and last x MB (md5)
- every x MB check a part of y KB
build md5 of subparts (c) and skip the rest (s):
cssssscssssscssssscsssscssssscsss
bernd
--
http://www.pi-phi.de/cheatsheet.html
More information about the TYPO3-performance
mailing list