Jcart wrote:
What I want to know is, does separating different function "types" (content, post, visitor, statistic handling, etc.) into a number of files and then including most of them even when just a few of them are needed affect performance and speed in PHP? I'm very concerned about this subject, as I want my CMS to be as optimized as possible
I believe Roja mentioned something along these lines about one of his webgames so hopefully he will be able to shed some light

Glad to.
As a general statement, the amount of load time generated by including N files is fairly trivial.
However, thats not to say you should immediately include a bazillion files, and damn the torpedos.
What I always suggest is benchmarking before changing. Run a benchmark on the large version of the file. Then split it up, save it as different (seperated) files, include those instead, and benchmark it.
Compare the results. Of course, you need to keep an eye on more than just page-gen time. Watch page response time (page gen time does a poor job of catching include speed differences, in my experience). Also watch server load, memory used, etc.
You may find that it decreases memory used, but increases server load. Or the opposite.
Each chunk of code is definitely unique. In part of TKI (a game I code), I include over a dozen files with less than a 1% impact across the board. However, in the same game, in another part of the game, I include just *four* files, and take a whopping 17% hit in performance.
Its all about whats being included, and what your goals are. A 1,000+ line file may use less memory than including 10 seperate 100 line files, but may take longer (more file operations).
But to generalize, as a guideline, it seems that 3-4 files and around 0-500 lines are the sweet spot between maintainability, speed, and optimal loading patterns.
Of course, we are talking about functions. I have a completely different experience with Classes, as it seems that the impact from class files is
lower than the impact from files full of functions. That may just be due to a small sample size, your mileage may vary, but it was interesting to me.
I feel compelled to edit and update.. It should be noted that others are far better at the "design" phase than I, so you may hear other opinions expressing an emphasis on OOP, which I don't disagree with in general. I was just answering the direct question.
