[Typo3-dev] TYPO3 3.7.0 memory usage ?

Michael Johnston mjohnston at planetactive.com
Fri Sep 17 16:38:02 CEST 2004


> Michael Johnston wrote:
>> pre-setting loop  boundaries
>
> You mean:
>
> $n = count($arr);
> for ($i; $i<$n; $i++) ;
>
> instead of
>
> for ($i; $i<count($arr); $i++) ;
>
> ?
>
> Seems to be common wisdom to avoid the latter.

It is, yes. I think all those lazily-coded loops were in my code, oops, 
lol. But then on the other hand I was religious about using single 
quotes from the beginning  :) Also there's this using isset instead of 
strlen thing -- it also makes a quite surprising difference on code 
that is doing it inside a big loop.

> Anyway, mindless optimization will get you nowhere.

No, you have to use the profiler.

>  I fear that some key parts need optimization and that scares me.

Yeah, scary with no automated way to (at least mostly) ensure the 
optimizations haven't broken stuff.  But often most of the scary things 
(changing passing arrays by copy to by reference  for example) are 
generally outside of loops, and it's the simple fairly safe-to-change 
things (ex, not using interpolated strings unnecessarily) that are done 
muchly inside loops and make the biggest difference.






More information about the TYPO3-dev mailing list