Jump to content

code using include statements


jonniejoejonson

Recommended Posts

I believe you have to strike a balance between includes and the amount of stuff you want to load.  You should set it up in a way where you load include files of only needed code.  I've seen all too often people including functions upon functions upon functions or classes upon classes upon classes for pages that never use them.  Make sure to only include files that you know for sure will be used everywhere on the site on all pages.  Other includes should be done when necessary.

The more files you load the greater performance loss does occur. Although the amount of loaded text seems to be the same, PHP must perform more disk operations to locate and open 10 files, instead of one. On the other hand, if your script loads too much unnecessary PHP code every request, it wastes time for parsing it.

 

Modern PHP frameworks tend to have more smaller files loaded, when they are really needed. Frameworks are unsually huge scripts and it's better to load only the necessary stuff. Furthermore, if your server has an accelerator installed, this is not so big problem, because commonly used files are kept in memory in the precompiled form.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.