08-18-2010, 04:54 AM
El Forum
08-18-2010, 05:02 AM
[eluser]mddd[/eluser]
You could just check if the variable exists:
As a side note: it is not a problem to load the same library twice. CI will just ignore the second $this->load command.
You could just check if the variable exists:
Code:
if (!isset($this->some_lib)) $this->load->library('some_lib');
El Forum
09-22-2010, 04:13 AM
[eluser]aidehua[/eluser]
Thanks mddd - I was going to ask that very question: what are the consequences (none? slight performance hit? serious performance hit?) of loading a model, library or helper more than once?
E.g. auto-loading it but then loading it again in the controller, or loading a helper in a controller and also in a library loaded by that same controller.
(Obviously in a perfect world you wouldn't load things twice. But my application isn't a perfect world. Not yet, anyway.)
From what you say, this isn't something I should worry about, right?
Thanks mddd - I was going to ask that very question: what are the consequences (none? slight performance hit? serious performance hit?) of loading a model, library or helper more than once?
E.g. auto-loading it but then loading it again in the controller, or loading a helper in a controller and also in a library loaded by that same controller.
(Obviously in a perfect world you wouldn't load things twice. But my application isn't a perfect world. Not yet, anyway.)
From what you say, this isn't something I should worry about, right?
El Forum
09-22-2010, 04:18 AM
[eluser]mddd[/eluser]
Correct. Don't worry about loading stuff twice.
You COULD look at whether you are loading stuff unneccesarily. If you are autoloading things that are only really used in some controllers/methods, you should consider moving the loading to the controller/method to reduce memory use. But that's a different problem.
Correct. Don't worry about loading stuff twice.
You COULD look at whether you are loading stuff unneccesarily. If you are autoloading things that are only really used in some controllers/methods, you should consider moving the loading to the controller/method to reduce memory use. But that's a different problem.