Re: DB_DataObject
| From: | Alan Knowles | Date: | Wed, 26 Feb 2003 11:52:21 +0000 |
| Subject: | Re: DB_DataObject | ||
| References: | 1 | Groups: | php.pear.general php.pear.general |
| Request: | Send a blank email to pear-general+get-3970@lists.php.net to get a copy of this message | ||
The secret history of DB_DataObjects :)
I did quite a bit of profiling on dataobjects a while back - as one of the applications was getting very slow - the two big performance hits where
a) debug() method calls
b) PEAR::getStaticProperty() calls on storing and retrieving database connecitons
in an effort to optimize it.
b) was solve by using global private variables _DB_DATAOBJECT['RESULTS'] etc.
** most of this should be fixed in PHP5 with static object vars..
a) was a bit more complex - as every debugging call had to make a call to the config to find out if it needed to be run - just doing this outside the calling operation didnt help, as it still had to do alot of function calls just to find out if it should debug..
In the end the best option I came up with was to initialize DB_DataObject on load, to check for the production var and set the global variable $_DB_DATAOBJECT_PRODUCTION
now if you load the configuration after you have loaded DB_DataObject - then you will have to call DB_DataObject::staticInitialize()..
I've not really come up with a better solution for this yet.. I guess it could be the first thing that is checked on _connect = eg. is $_DB_DATAOBJECT_PRODUCTION === false - if so load it from the config..
Thoughts/ideas welcome...
Regards
Alan
Limbourg Arnaud wrote:
Hello, I've got a little problem with DataObject in the ini file i set the fiollowing vars debug = 0; default debugging levelproduction = 1 And when i execute a script i see that when doing a get_defined_vars()[_DB_DATAOBJECT_PRODUCTION] => 0Anybody encountered this problem ? (i must admit i didn't browse the list archive for this) Thnaks, Arnaud