More microptimisation (Was Re: [PHP] Variable as an index)
| From: | Clancy | Date: | Mon, 22 Dec 2008 22:10:58 +0000 |
| Subject: | More microptimisation (Was Re: [PHP] Variable as an index) | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-284980@lists.php.net to get a copy of this message | ||
On Mon, 22 Dec 2008 10:20:09 +1100, dmagick@gmail.com (Chris) wrote:
............
>I'd call this a micro-optimization. If changing this causes that much of
>a difference in your script, wow - you're way ahead of the rest of us.
Schlossnagle (in "Advanced PHP Programming") advises:
$i = 0; while ($i < $j)
{
........
++$i;
}
rather than:
$i = 0; while ($i < $j)
{
.......
$i++;
}
as the former apparently uses less memory references. However I find it very hard to
believe that the difference would ever show up in the real world.