You are here: Re: Why Returning References can't provide speed up? « PHP Programming Language « IT news, forums, messages
Re: Why Returning References can't provide speed up?

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация