[TYPO3-core] RFC: #11271: Use 2 level cache for BEgetRootLine

Steffen Kamper info at sk-typo3.de
Fri Jun 5 22:53:07 CEST 2009


Hi Rupi,

Rupert Germann schrieb:
> hi
> 
> I wrote some "is-it-worth-caching-this?" codelines which might be helpful in
> this and other cases.
> 
> insert this at the beginning of the function you want to test:
> 
> $s = microtime(TRUE);
> $tmpCI = debug_backtrace();
> $call_info = $tmpCI[1];
> unset($call_info['args']);
> unset($call_info['object']);
> 
> then add something like the following lines at the points where a cache hit
> respectively a miss occurs:
> 
> debug(array(
>   'HIT time: '=>number_format(floatval((microtime(TRUE)-$s)*1000),5). ' ms',
>   'caller'=>$call_info,
>   'BEgetRootLine_cache'=>$GLOBALS['T3_VAR']['BEgetRootLine_cache'],
>   '$uid'=>$uid,
>   '$clause'=>$clause,
>   '$workspaceOL'=>$workspaceOL), ' ('.__CLASS__.'::'.__FUNCTION__.')',
> __LINE__, __FILE__, 3);
> 
> that should give you some information about how often the method is called,
> how long does it took and who called it.
> 

thx for sharing it ;)

> in our current case it shows that the page module seems to produce the most
> activity in BEgetRootLine. The function is called 7 times causing 2 misses
> (because the $workspaceOL value changes) and 5 hits.
> (the list module produces only 2 misses and one hit)
> 
> since BEgetRootLine searches the rootline upwards until page 0 the amount of
> executed queries is quite limited - honestly, how deep are your pagetrees? 
> It's not comparable to the caching in getTreeList which can save thousands
> of queries with one cache request.
> 
> I suggest to leave it as it is because the amount of testing for possible
> sideeffects of not correctly cleared cache entries and also the possible
> speed gain does not justify the effort.
> 

i'm working on mainly two sites having a huge page tree (20000 +) and 
where some operations block the work for minutes! So i see a reason for 
speeding that up. I know biggest part of time there is the calculation 
of user rights which isn't part of the getRootline here, but in general 
i'm for any speed optimization that is possible.
I will investigate it more and also will come up with some measuring, 
then we see how much sense it makes.


vg Steffen


More information about the TYPO3-team-core mailing list