RE: [PEAR-DEV] Obsoleting PEAR.php
| From: | Patrick O'Lone | Date: | Fri, 16 May 2003 17:27:13 +0000 |
| Subject: | RE: [PEAR-DEV] Obsoleting PEAR.php | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-16371@lists.php.net to get a copy of this message | ||
Actually, there is a scalability issue with using the PEAR base class
right now. Since a class that extends the PEAR class automatically gets
a destructor, there is no way to remove an instance from memory until
shutdown time or by explicitly doing:
$objInstance = null;
Of course, that creates errors at shutdown time since the object no
longer exists and the _PEAR() destructor will be called. This is
fundamentally a problem considering the _PEAR() destructor does one
thing - output debug information.
The scalability issue comes into play when you create a loop and create
several instances using a PEAR-derived class. Suppose you were using a
XML parsing class that retained the parsed data in memory. Each
iteration of the loop would normally cause the original object instance
to be replaced with a new instance, thus conserving memory through the
life-cycle of the program. Unfortunately, because of the _PEAR()
destructor, each instance must be retained, so you eventually run out of
memory (or hit the memory limit set in the php.ini file) if you create
several hundred instances.
If you have questions, comments, or suggestions about the aforementioned
message, you can respond by replying to this message or contacting us at
(309)-743-0800. Thank you.
Regards,
Patrick O'Lone
Internet Software Engineer
TownNews.com
(309)-743-0809
polone@townnews.com
> -----Original Message-----
> From: Martin Jansen [mailto:mj@php.net]
> Sent: Friday, May 16, 2003 12:14 PM
> To: Sterling Hughes
> Cc: pear-dev@lists.php.net
> Subject: Re: [PEAR-DEV] Obsoleting PEAR.php
>
>
> On Thu May 15, 2003 at 06:1743PM -0400, Sterling Hughes wrote:
> > One of my major problems with PEAR is the underlying framework.
> > Nearly every class in PEAR seems to extend from the PEAR
> base class,
> > when its really not required for most of them [1]. The end
> result of
> > this is
> > *slower* code that is a part of the framework. I suggest
> that for now
> > we start removing the usage of the PEAR class from the
> large majority of
> > code in PEAR. This should speed up the code considerably (no extra
> > overhead).
>
> Agreed. A quick grep through /pear revealed that 80 classes
> are extending from PEAR and my wild guess is that only 30% of
> them really need anything that is provided there (like destructors).
>
> --
> - Martin Martin Jansen
> http://martinjansen.com/
>
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>