Doctrine lazy loading classes takes 100 ms?!
        Posted  
        
            by ropstah
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by ropstah
        
        
        
        Published on 2010-04-09T22:59:27Z
        Indexed on 
            2010/04/09
            23:03 UTC
        
        
        Read the original article
        Hit count: 507
        
I'm lazy loading my Doctrine classes in my website. Benchmarking has showed that Doctrine::loadModels('models') takes over 100 ms to complete! I have 118 tables in total, but still...
setting attribute to conservative loading:
Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_MODEL_LOADING, Doctrine::MODEL_LOADING_CONSERVATIVE);
running the benchmark part:
$CI->benchmark->mark('Doctrineload_start');
Doctrine::loadModels(APPPATH.'models');
$CI->benchmark->mark('Doctrineload_end');
And the result:
Doctrineload    0.1085 (seconds)
Is this 'normal'?
'context':
Loading Time Base Classes   0.0233
Doctrineinit    0.0435  //doctrine_pi.php file, doctrine configuration + db account
Doctrineload    0.1085
Masterpageset   0.0001
Userload    0.1208 //1 db query
Masterpageaddcontent    0.1565 //1 db query, loading view with some <?=?> php parsing
Masterpageshow      0.0203 //loading view
Controller Execution Time ( Home / Index )      0.3591
Total Execution Time    0.3826
© Stack Overflow or respective owner