Re: Mem and variables
| From: | Richard Lynch | Date: | Wed, 22 Aug 2001 00:03:38 +0000 |
| Subject: | Re: Mem and variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-63831@lists.php.net to get a copy of this message | ||
> odd question, but if variables are stored in memory
> until the script terminates, that includes old unused
> variable, isn't it more efficient, memory wise, to
> reuse old variables that reference, in effect the same
> basic data, rather than create new or additional
> variables
The difference would only be measurable if you had a *LOT* of variables...
Like, a whole lot.
Also, PHP *may* (for all I know) have to do more "work" to execute:
$string = substr($string, 0, 10);
than:
$foo = substr($string, 0, 10);
Dunno if it helps or hurts or has no effect for PHP to have to worry about
where the string is going after it does substr, but it *MIGHT*.
At any rate -- The right way to worry about perforance is to figure out
where your code is spending 90% of its time, and to optimize that. I'm
betting it ain't in variable lookups for most of us :-)
--
WARNING richard@zend.com address is an endangered species -- Use
ceo@l-i-e.com
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm