Basically I have lots of code in models and although the model might've been loaded elsewhere I like to make sure by doing $this->load->model()
almost everywhere its used. Is that all right, or does it use up any resources even if the model has already been loaded?
views:
833answers:
3
+4
A:
The constructor will be executed every time you call $this->load->model(), but the file itself will be loaded only once. It might make sense to put your often-used model into application/config/autoload.php
RommeDeSerieux
2009-03-01 15:58:27
A:
I always load the resources myself instead of using autoloader, because every load of model will go to disk to fetch object which I think can be slow. Especially when a lot of concurrent users are on your site.
Alfred
2009-03-01 16:02:45
A:
Its better to load the model in the constructor.so tat no need to repeat the code again and again..
Aruna
2009-03-19 12:01:53