Re: PHP Performance and System Load

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sancar Saran wrote:
> Another simple performance tip.
> 
> Most of for examples of php look like this
> for($x=0;$x<sizeof($arrSometing);$x++)
> 
> This is bad. In every cycle you call sizeof
> 
> this was good
> $intSize = sizeof($arrSometing);
> for($x=0;$x<$intSize;$x++)
> 
> if u use.
> for($x=0;$x<$intSiz;++$x). You may gain another %10 
> 
> to determine costs of your functions use xdebug and kcachegrind.

I've always used pre-increment in loops like you suggest as it was an
ingrained part of my C/C++ learning from a performance perspective. I
wasn't sure if the same was true in PHP but you seem to suggest it is,
so I feel justified now :)

Col

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux