Re: [Coding Standards] Loading all files at once
| From: | Lukas Kahwe Smith | Date: | Sun, 15 Jul 2007 11:52:35 +0000 |
| Subject: | Re: [Coding Standards] Loading all files at once | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-47498@lists.php.net to get a copy of this message | ||
Matthew Weier O'Phinney wrote:
A recent blog entry got me to thinking: why is the performance of require/include_once being touted as a necessary optimization at all? Typically, loading up the various library files necessary for your application is but a small fraction of the total processing time; in most applications where you need to worry about performance, you're needing to think about optimizing your database calls, web service calls, etc. -- not the amount of time you spend loading files.The speed freak will be doing all of the above, so he will definitely appreciate this.
On the flip side, as a number of people have already indicated, environments with opcode caches are *not* the only environments around. Many use shared hosting environments, where opcode caches are not installed or cannot be installed; and in most development environments, you will typically *not* have opcode caching turned on to prevent a stale cache from masking changes to your code. A solution such as allfiles.php would be introducing unnecessary and unwanted overhead, as extra, unnecessary files are loaded on each request. What I'm seeing is a solution that caters specifically to high availability production environments at the expense of others.Autoload can reduce the overhead when running without an opcode cache, since you skip loading of unused code. Autoload also provides you all the previous flexibility (and more) with a single tiny additional step. I am unable to see any real drawback at all. 1) speed freak .. obviously very happy more performance, more flexibility 2) unzip and go guy setup autoload .. leverage include path or whatever more performance, more flexibility 3) installer guy setup autoload .. leverage include path or whatever more performance, more flexibility regards, Lukas So all in all I do not see what the fuss is about. I feel this solution improves the situation for all target audiences, for some more than others. Of course some things will change as a result.