[TYPO3-core] RFC #0011512: replace while(list()...) by foreach in the TYPO3 core part 1

Christian Kuhn lolli at schwarzbu.ch
Sun Aug 2 15:44:42 CEST 2009


Hi,

Rupert Germann wrote:
> Type: performance improvement
> 
> Bugtracker references:
> http://bugs.typo3.org/view.php?id=11512
> 
> Branches: Trunk
> 
> Problem:
> foreach() has proven[1] that it is way faster than while(list()=each()) and
> in current PHP versions foreach() even needs less memory than while().
> 
> Solution:
> replace while(list()=each()) with the appropriate foreach() statements in
> frontend classes

+1 on reading, testing and profiling.

As it's impossible to really test every change, I just read the diff
with attention and verified there is no change in behavior on two of my
sites.

Attached patch takes Steffen's nitpicking for Line 88, 394 and 456 into
account, while 799 is unchanged (key is not used, no reason to add it).

My quite simple test-sites showed (non-cached) performance advantages
around 1 percent. This is near to my usual testing variance, however non
of my "post-patch" runs where slower than without patch.
As Rupert already mentioned, the patch will probably have more impact on
complex pages with eg. deep menu structures.


Regards
Christian
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 11512_while_foreach_p1_v3.diff
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20090802/e4d19d08/attachment-0001.txt 


More information about the TYPO3-team-core mailing list