Search code examples
phpcodeigniterautoloadautoloader

Curiosity: Will too much autoload in codeigniter make application slower?


I'm using php and codeigniter, It has autoload class. My first question is,

If I use autoload class to load all model will it make my application slower? Or is there no effect?

My second question :

Which one is better and faster, loading all model you need using autoload class, Or load only some models you need in a class function?

Solution

  • 1) Autoload class will obviously make your application slower. because it uses php4 require function to load files. there are some hacks to use php 5 autoloading feature. Hope, new owner of codeigniter will add add support for autoloading.

    2) It is best to use load specific models rather than autoload. in previous point I stated the reason behind this. basically it is good practice to load only the needed model, helper, library and assets. it assures that you use minimum time and memory.