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

Xavier Perseguers typo3 at perseguers.ch
Tue Aug 4 15:11:01 CEST 2009


Hi Rupert,

> Michael Stucki schrieb:
>> there are two things in the patch which I don't really like. Not sure if
>> you did that by intention or by mistake. If so, please let me know.
>> Otherwise, I'm going to commit this follow-up (see attached)...
> 
> both are done by intention
> 
> I used "pre-increment" at --$c; because it's faster than post-increment: 
> http://www.tuxradar.com/practicalphp/18/1/8
> and this is a speed critical function.

 From the webpage you give:
Note that both the Zend Optimizer and IonCube PHP Accelerator will 
implement this optimisation for you.

I agree with Michael, I saw this too but was too lazy to say something.

This is typically an optimization which does nothing in _our_ real life. 
I used to do those stuff too when I was still at school but there is 
many more to optimize in TYPO3 before _needing_ those optimizations. 
Those optimization do nothing but make the code trickier to understand.

> concerning "assignments in conditions" CGL says:
> 
> "Assignment in conditions should be avoided. However if it makes sense 
> to do assignment in condition, it should be surrounded by the extra pair 
> of brackets. Example:
>     if (($fields = $GLOBALS['TYPO3_DB']->sql_fetch_result($res))) {
>         // Do something
>     }
> "

I did not know that extra pair of parentheses (not brackets) removed the 
warning in IDE. Good to know and I would tend to do this for new code 
instead of getting all those nasty warnings with current code. However, 
doing an assignment and then a test on $fields would be even better coding.

Cheers

-- 
Xavier Perseguers
MVC ExtJS Leader

http://forge.typo3.org/projects/show/extension-mvc_extjs


More information about the TYPO3-team-core mailing list