[TYPO3-core] RFC: Feature Request 6037: Performance tunning in t3lib_div by removing elderly PHP functions

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Mon Sep 3 14:11:05 CEST 2007


Oliver Hader schrieb:
> Hi Michael,
> 
> Michael Stucki schrieb:
>>> Furthermore references are a bit faster if working with arrays, e.g.
>>> $tca =& $GLOBALS['TCA']['tt_content']['columns']['bodytext']
>>> is faster than using it without reference, e.g.
>>> $tca = $GLOBALS['TCA']['tt_content']['columns']['bodytext'].
>>>
>>> If found other recources on the web which state that
>>> "while(list(,$value)=each($array))" would be faster than calling
>>> "foreach ($array as $value)". But I could not reproduce this with PHP5
>>> and the profiler of the PEAR extension "Benchmark".
>>>
>>> I've created a new patch. See attachment.
>> Hmm. Hard to test, but I tried:
>> http://localhost/quickstart/typo3/index.php
>> => redirects me to http://localhost3opyt/tratskciuq//alt_main.php
> 
> Oh, oh... thanks! ;)
> A reference operator "&" was missing in revExplode(). I checked again
> all changed foreach calls for these referencing things and fixed the
> behaviour you pointed out.

Did you profile also "foreach ($array as &$key => &$value)"?

Most loops don't modify the loop arguments and so refernces could be used. 
That is if, they are faster.

Masi


More information about the TYPO3-team-core mailing list