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

[eluser]veledrom[/eluser]
As I am new in CI, I read about MY_Controller (here) to understand why you suggested me to use it instead for all those $this->load..... bit in its __contruct() but to be honest I didn't quiet understand why to use it.

What would it be difference between these two? I am really interested in performance side of it. Remember, there are many methods in the main class and these loads are not necessarily related to all methods. Some methods need some and others don't. In any cases they are loaded with this way. Would it slow my application down?

Code:
class Mysite extends CI_Controller {
   function __construct()
   {
      parent::__construct();

      $this->load->helper('url');
      $this->load->helper('form');
      $this->load->helper('captcha');
      $this->load->helper('download');
      $this->load->library('one');
      $this->load->library('another');
      $this->load->library('andother');
      $this->load->model('one');
      $this->load->model('two');
      $this->load->model('three');
   }

Code:
class Mysite extends MY_Controller {
   function __construct()
   {
      parent::__construct();

      $this->load->helper('url');
      $this->load->helper('form');
      $this->load->helper('captcha');
      $this->load->helper('download');
      $this->load->library('one');
      $this->load->library('another');
      $this->load->library('andother');
      $this->load->model('one');
      $this->load->model('two');
      $this->load->model('three');
   }


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