[TYPO3-core] RFC #11410: Speed up BEgetRootLine by reusing parts of the rootline from the cache

Rupert Germann rupi at gmx.li
Sat Jun 27 18:14:08 CEST 2009


hi,

I have a follow up suggestion for this patch.

Problem: 
one cache was dropped, another one was introduced. That makes calls for many
different rootlines way faster but it also slows down performance if many
calls are requesting the same rootline. This is because function
BEgetRootline does not cache its output anymore and so some evil and
expensive while(list()=each()) code has to be executed.

Solution: cache both functions (and replace the while loop).

Testing:
I made a quick&dirty benchmark by adding this code at the beginning of class
db_list.inc function main():

$s = microtime(TRUE);
for ($z = 0; $z < 10; ++ $z) {
        for ($i = 400; $i < 2400; ++ $i) {
                $test = t3lib_BEfunc::BEgetRootLine($i, '', TRUE);
        }
}
debug(number_format(floatval((microtime(TRUE)-$s)*1000),5). ' ms','time: ');

this calls BEgetRootLine 20000 times.
(most of the pages in this installation have uids between 400 and 2400, the
rootlines are up to 8 levels long)

Result:
before Fabrizios patch: ~3200 ms 
with Fabrizios patch:   ~1700 ms
with 2-level cache:     ~220 ms

what do you think ? ;-)

greets
Rupert



Oliver Hader wrote:

> FYI: Committed to SVN Trunk (rev. 5635)
> 
> olly
> 



More information about the TYPO3-team-core mailing list