[TYPO3-performance] TS-Rendering - IMG_RESOURCE - 622 ms - Solution

Martin Kutschker masi-no at spam-typo3.org
Wed Sep 30 13:38:42 CEST 2009


JoH asenau schrieb:
>>> So let's see which options we've got so far:
>>> 1 different mtime => same content or different content
>>> 2 different mtime => same size or different size
>>> 3 different size => different mtime and (different content or same
>>> content) 4 different content => different mtime and (different size
>>> or same size)
>>>
>>> Since we want to avoid 4 the only way to go seems to be 3, since 1
>>> and 2 might lead to a performance loss.
>> I'm either dumb or still lack coffee at this time of day. I don't get
>> what's left and right of the arrow.
>>
>> So I probably just phrase 3 in other words:
>>
>> If the size differs it's clear that the content has changed.
>> If only the mtime changed the content could have changed.
>> In this case we *could* check the md5 hash to be sure.
> 
> If you change "could check" to "must check", I agree :-)
> 
> if(mtime changed) {
>     if(size changed) {
>         make new image
>     } else if (content changed) {
>         make new image
>     } else {
>         do nothing
>     }
> } else {
>     do nothing
> }

The "could" stems from this approach:

if (size changed) {
  make new image
} else {
  if (mtime changed) {
    if (noContentCheckFlag set || content changed)
       make new image
    }
  }
}

Any size change must trigger a new file. No need to check anything else.

Masi


More information about the TYPO3-performance mailing list