Welcome Guest, Not a member yet? Register   Sign In
$this->load->... in __construc() performance
#8

[eluser]veledrom[/eluser]
Looks like putting all $this-load.. bits in __construct doesn't slow the application.

Benchmark returns same value even if I put $this-load.. bits in different methods.

Code:
class Cache extends CI_Controller {
    
    public function __construct()
    {
        parent::__construct();
        
        
        $this->load->helper('url');
        $this->load->helper('database');
        $this->load->helper('form');
        $this->load->helper('download');
        $this->load->helper('captcha');
        .
        .
        .
        
        
        $this->load->model('cache_model');
        $this->load->model('cache_model2');
        $this->load->model('cache_model3');
        $this->load->model('cache_model4');
        .
        .
        .
        .
    }
    
    public function index()
    {
        $this->benchmark->mark('code_start');
        //sleep(5);
        $this->benchmark->mark('code_end');
        
        echo $this->benchmark->elapsed_time('code_start', 'code_end');
    }
}


Messages In This Thread
$this->load->... in __construc() performance - by El Forum - 05-15-2011, 02:07 AM
$this->load->... in __construc() performance - by El Forum - 05-15-2011, 02:39 AM
$this->load->... in __construc() performance - by El Forum - 05-15-2011, 09:53 AM
$this->load->... in __construc() performance - by El Forum - 05-15-2011, 01:32 PM
$this->load->... in __construc() performance - by El Forum - 05-16-2011, 01:42 AM
$this->load->... in __construc() performance - by El Forum - 05-16-2011, 02:22 AM
$this->load->... in __construc() performance - by El Forum - 05-16-2011, 02:23 AM
$this->load->... in __construc() performance - by El Forum - 05-16-2011, 03:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB