views:

833

answers:

3

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?

+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
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
A: 

Its better to load the model in the constructor.so tat no need to repeat the code again and again..

Aruna