|
Posted by Michael Fesser on 02/08/07 22:12
..oO(howa)
>from PHP manual, it said:
>
>>> http://hk.php.net/manual/tw/language.references.return.php
>
>Do not use return-by-reference to increase performance, the engine is
>smart enough to optimize this on its own
>
>------------------
>
>Why?
>
>The bottom line from my view in using reference in all my codes are :
>
>1. memory allocation need time! why not use reference?
>2. you waste memory for storing two copies of data
Memory is usually not an issue on recent machines.
>Return-by-reference should at least faster, more efficient, so I can't
>find a reason not using it.
Not necessarily. It depends on how references and object copies are
handled internally. The engine itself knows better than you how to
optimize such things.
It's like trying to "over-optimize" an SQL query, where the built-in
query optimizer could do a much better job.
Micha
Navigation:
[Reply to this message]
|