CodeIgniter Forums
Auto Load Model - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Auto Load Model (/showthread.php?tid=54594)



Auto Load Model - El Forum - 09-16-2012

[eluser]Kiran Dangol[/eluser]
Hi Everybody,

I have a question regarding auto loading models. Will autoload models affect in performance in website?

Thanks in advance.


Auto Load Model - El Forum - 09-16-2012

[eluser]Sagar Ratnaparkhi[/eluser]
This instructing CI to auto load your models into memory. It wont much affect on site performance. But usually its good to keep most used models in autoload (which needed in most of controllers),else get loaded specifically.

Btw. You can use CI's profiler to review performance.


Auto Load Model - El Forum - 09-16-2012

[eluser]Kiran Dangol[/eluser]
Hi Sagar,

Thanks for answer. Now what about library. Will it too affect in speeding?


Auto Load Model - El Forum - 09-16-2012

[eluser]PhilTem[/eluser]
It's not easy to answer, but let's state it like this: If you're running on an old machine and autoload 10 models, 10 libraries, 10 configs, and 10 helpers, it will slow down the webserver thus taking longer to create the page plus you will have less memory available for further requests on your server at the same time.
However, if you're running on a rather new machine with some 2GB of RAM it might not be that horrible to autoload many models, libs, ....
Though anyway it is better to load models on a load-when-needed paradigm. Makes your code run faster plus it's just more intuitive, that you load stuff only when you need it thus keeping resources available for other tasks Wink


Auto Load Model - El Forum - 09-16-2012

[eluser]Kiran Dangol[/eluser]
Many many thanks to PhilTem. I got clear vision now.
Thank you a lot.