On Thu, 2006-07-27 at 01:35, Larry Garfield wrote:
> On Wednesday 26 July 2006 21:41, Robert Cummings wrote:
> 
> > > I'm working on some code that would be called to generate a cell in a
> > > possibly large table and therefore a small difference in performance
> > > may have a significant impact.
> >
> > PHP uses copy-on-write and so copies are essentially shared until such
> > time as you modify one of them. If you don't need references then copies
> > are faster than references.
> 
> By the same token, then, if I have a function that generates a large string 
> and returns it, is there any benefit to return-by-reference?

Nope. You should only use references if you really need them. Attempting
to improve efficiency by using references instead of copies when you
aren't actually in need of a reference will result in less efficiency
since the engine spends more time creating the reference than the copy.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

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

Reply via email to