[development] Open season for references

Peter Wolanin pwolanin at gmail.com
Tue Mar 6 19:19:15 UTC 2007


Chx,

reading this link you reference says to me that there should be no
speed advantage in PHP 4+ for passing in an array in as a reference
*unless* you're modifying an element of the array.  If you modify and
return the array, it seems this will take more memory and computation
than passing it in by reference (e.g. hook_form_alter) ?

-Peter

From: "Karoly Negyesi" <karoly at negyesi.net>
To: development at drupal.org
Date: Tue, 06 Mar 2007 19:15:40 +0100 (CET)
Subject: Re: [development] Open season for references
> References have a place in programming and do help with performance when
> dealing with large objects or arrays.

Wrong on arrays.

http://web.archive.org/web/20060427154547/http://www.zend.com/zend/art/ref-count.php

Objects in PHP4 yes but while we want Drupal working still on PHP4,
it's not a preference or priority any more at least for me. So if
there is a minuscule performance penalty 'cos ancient PHP versions
copy around objects so be it. As said, if I find the need for more
advanced array function, I will use them and reimplement them for
PHP4.


More information about the development mailing list