• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 174
  • Last Modified:

php includes

Dear all,

when i write this these pages i use include files for to increase flexibility. i  would like to if this increase load of the page, since this inc page would include lot of utilities, constants and so on....
rather than giving every thing in a single file is wise to break up those in to secitons and include as separate files.

1 Solution
Indeed, when including files, they always need to be read (increasing file I/O) and parsed (increasing CPU/memory). So it would be better to only include files whenever you need them.

On the other hand, files that are used very often are very efficiently handled by your OS. And when you use something like ZEND optimizer, the parsed files are stored. The impact would then be quite little.

Also, when you are not encountering any problems with your request-load (i.e. the impact on the server with a single call to a page) then you don't need to bother with optimizing this (unless you expect it to be a problem in the future of course).
I always think of a glossary when I think of EXT3 or NTFS file systems... Imagine looking for "water" in a dictionary, and it says "See: Liquid". So you look up liquid next.

Always ask yourself if a division is necessary. If everything can be in one file, that may be better. Really, you're looking at two requests (minimum) per file -- one for the file allocation table, and one for the file, plus seeks for every fragment *N.

Programs such as eAccelerator and Zend Accelerator fix this somewhat.

Bottom line, only split when you have to. It's much faster. That and load reused data (READ: Sql and files) into shared memory using a program like eAccelerator. That makes a huge difference.

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now