• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Model Loading Optimization

I'm building my first CI site, and in the spirit of CI's lightweight mantra, I'm trying to decide what is the best way to load my models. Here's the situation: I've got several types of pages, and to create my navigation dynamically, I'm loading the models for each page type based on information in my database. That results in a call to
for every navigation item on a page (there are between 8 and 12 on each). However, there is no guarantee that each page will utilize all potential models.

So my question boils down to this: Is it more efficient to call
repeatedly (which does just return if the model is already loaded -- I checked the source), or would it be more efficient to autoload all page models
$autoload['model'] = array('page', 'event', etc...)
(there would be about 5) with every request?

Thanks for any input!

[eluser]Colin Williams[/eluser]
If you aren't running queries from your Model constructors, I don't see how awful loading 5 files and instantiating 5 classes could be. Easy enough to test/benchmark.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.