[Typo3-dev] decrease memory usage

Christian Jul Jensen christian at jul.net
Mon Sep 8 09:44:32 CEST 2003


Hi,

On Sat, 06 Sep 2003 13:17:13 +0200
"Kasper Skårhøj" <kasper at typo3.com> wrote:

> I read that copies of strings and arrays are just fine and faster than
> reference. But Objects - that should be faster with a reference. And
> I'm not the big reference-master I have to say. 
> 
> I would appreciate if someone reviewed AND TESTED the use of object
> references in TYPO3. Obvious places to start is:
>  - t3lib_div::makeInstance() - should that be returning a reference?
>  - Setting of $this->cObj, $this->pObj etc in various classes.

AFAIK php version < 5 doesn't really support referencing of objects, it
is in fact a copy.

Real object-referencing should be supported in version 5, asfar as I
understand.

I definetly think that references should be used in stead of copies.
Main reason for this is: If the object changes after the initialisation
of the local reference / copy, a reference will change as well, a copy
will not. I've already had problems with this (not with the native TYPO3
classes, but with the feEdit, but anyhow...). A second reason is that as
far as I remember my compiler theory, the use of references should be
mpre efficient in speed and memory usage. I'm not 100% sure about the
former, and that of course also depends on the implementation of the
compiler, but my impression is that the zend folks are pretty capable.

-- 
./mvh Christian Jul Jensen
      Freelance webprogramer
      TYPO3 Typehead Denmark




More information about the TYPO3-dev mailing list