Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Performance of Module::load when loading all modules
  • Hi, I've got a simple question I think. In one of my projects I need to use config and lang of every module in my app. 

    Currently I jst use something like:
    foreach ($modules as $mod)
    {
        Module::load($mod->folder); 
        Lang::load($mod->folder.'::resources', $mod->folder.'_resources');
        Config::load($mod->folder.'::resources', $mod->folder.'_resources');
    }

    I wonder if that will reduce the performance of my application to load every single module like that? There can be dozens of files to include.

    Another solution is creating one config / lang file for all modules and making insertions there at module "installation".
  • HarroHarro
    Accepted Answer
    It's better to load it where you need it, and keep everything together.

    Fuel is smart enough to detect that what you load is already loaded, and will abort the load immediatly, leaving the overhead limited to the method call.

    If speed is really essential, and you're worried about file I/O: I run some of my apps from tmpfs (which is in memory) to solve that issue.
  • + for tmpfs ;)
    Thank you!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion