logo       
Google Custom Search
    AddThis Social Bookmark Button

RE: DB_DataObject: msg#00431

Subject: RE: DB_DataObject
> 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

Indeed, getstatic property calls represent half of the time spent in a
script i have which is pretty database intensive. It still executes quite
fast but other scripts are just too slow.

Total Elapsed Time =    0.32
Total System Time  =    0.01
Total User Time    =    0.31


         Real         User        System             secs/    cumm
%Time (excl/cumm)  (excl/cumm)  (excl/cumm) Calls    call    s/call  Memory
Usage Name
----------------------------------------------------------------------------
----------
 35.5  0.11  0.11   0.11  0.11   0.00  0.00  1267   0.0001    0.0001
0 pear->getstaticproperty
  6.5  0.01  0.01   0.02  0.02   0.00  0.00     4   0.0050    0.0050
0 function_exists
  6.5  0.03  0.03   0.02  0.02   0.00  0.00   208   0.0001    0.0001
0 mysql_fetch_array
  6.5  0.01  0.01   0.02  0.02   0.00  0.00   119   0.0002    0.0002
0 define
  6.5  0.00  0.03   0.02  0.03   0.00  0.00   204   0.0001    0.0001
0 dataobjects_tbl_mytable->debug
 


> 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()..

Ok, i'll check that.
 
> 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..

Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>