Re: Reference or copy?

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

 



On Wed, 2008-07-23 at 01:21 -0700, Ted Wood wrote:
> On 23-Jul-08, at 1:19 AM, Ted Wood wrote:
> >
> > So PHP waits until a copy is actually needed before it makes one.  
> > Explicitly making copies incurs overhead because of the concept of  
> > "reference counting". So again, don't use references for performance  
> > reasons.
> 
> 
> That should've been:  Explicitly making "references", not copies...

This only applies to PHP5. PHP4's Copy-On-Write (COW) for objects was
crap and would clone the object on assignment. It was especially bad
when looping over an array of objects since each would be cloned so you
usually had to loop over the keys of the array and pull out a reference
yourself.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


-- 
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