Re: extends PEAR
| From: | Lukas Smith | Date: | Sat, 16 Oct 2004 15:24:52 +0000 |
| Subject: | Re: extends PEAR | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-33897@lists.php.net to get a copy of this message | ||
Greg Beaver wrote:
Lukas Smith wrote:Ah yes ... your are right!Greg Beaver wrote:Actually, the register_shutdown_function() call is not in the PEAR constructor, but instead in the global code at the end of PEAR.php.Not necessarily. The act of registering the shutdown function adds a significant overhead in my profiling tests. If you lazy-register the shutdown function (only when a transaction is initiated), then you could save a bundle of time for the more common cases.Thats an interesting point. However I could also take advantage of this by only calling the PEAR constructor during the first transaction. So this is not a point relevant to the original question though.
Perhaps this could be changed to be called in the constructor instead, using a static to determine whether it has been called? It would be a significant boost in the functionality of objects that don't have a destructor. The constructor could check for the presence of a destructor with method_exists($this, '_' . get_class($this)) as it does in the actual destructor.yup sounds like a very good idea! regards, Lukas