Re: minute performance gain

From: Date: Mon, 18 Oct 2004 17:17:50 +0000
Subject: Re: minute performance gain
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-33942@lists.php.net to get a copy of this message
Lukas Smith wrote:
Jon Parise wrote:
On Sun, Oct 17, 2004 at 02:05:15PM -0400, Greg Beaver wrote:
I took the register_shutdown_function and moved it to the PEAR class constructor, inside the code that checks for destructors, and found a miniscule performance gain. Zend IDE's profiler reported that the time it takes to run 'PEAR.php'; decreased from .35 ms to .28 ms. By far the most significant performance hit comes from the require_once call, which leads me to believe that even using PEAR_Exception would do nothing to improve performance unless you put everything in 1 big-ass file. :)
To be fair, you only see this performance gain when no destructor is exists (and register_shutdown_function() is not called), yes?
Yup .. That brings me to another issue. Since the PEAR class defines a destructor it kinda sucks to extend from PEAR needlessly. Obviously if you dont call the PEAR class constructor you get around this issue.
As my last email says, the PEAR destructor is never automatically registered thanks to the strcasecmp('pear') check, you have to explicitly call it through $this->_PEAR() in your own destructor, and I believe Stig designed it to be for debugging purposes only. Greg

« previous php.pear.dev (#33942) next »