Re: [Coding Standards] Loading all files at once

From: Date: Wed, 11 Jul 2007 16:58:40 +0000
Subject: Re: [Coding Standards] Loading all files at once
References: 1 2 3 4 5 6 7  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-47424@lists.php.net to get a copy of this message
Some would say the having all the includes in a single file is the simpler to manage approach not the current way. I understand not wanting to change but I wouldn't call allfiles obfucation -josh Alan Knowles wrote:
So these statistics are saying a 15% improvement could be made by grepping all the ^require_once '......php';$ out of pear files, and putting them into a single file that calls require. This is an obviously simple task for either the installer or a optimization tool. But clearly is not sufficient to justify obfuscating the code in PEAR? For anyone requiring that degree of optimization, the minimal effort of pre-processing the libraries would probably be done after a significant amount of work doing various tasks like database caching, output caching, APC and many other methods and really is not a good justification for this change to the standards. Regards Alan
And I have just as concrete benchmarks that should the exact opposite. For all the files used in my benchmark include results from every run: http://www.adamashley.name/stuff/require-benchmark.tar.bz2 The basic idea of my latest set is run AB against a page that includes a set of three objects from three files that make up a mythical package. Include path is set at the beginning of each file. The only difference between each set is how the files are attempted to include. All of my runs have been under APC. There are 4 test cases: current - like a PEAR1 object require_once all over the place. depend on include_path autoload - basic __autoload function. require $class.php; because of the way autoload works if autoload is doing everything dont need to worry about the _once you'll never hit a duplicate. allfiles - the proposed allfiles.php depend on include_path speedfreak - list every file you need and none you dont with full paths. The results:
current    - 1937 req/s
autoload - 2170 req/s allfiles - 2316 req/s speedfreak - 2294 req/s Notice all the proposed ways are faster when using an opcode cache than the current way of doing things. As for speedfreak's poor performance I wouldn't expect a speed up from it until you are including less files than the allfiles methon (ie for a DB container, include DB, DB_Container, and DB_Container_MySQL instead of all the drivers). These test where run on Athlon 64 X2 2800, 1GB RAM, Ubuntu 7.04, Apache 2.2.3, PHP 5.2.4 and APC 3.0.14. Anyone wants to critique my methods everything (code, script to run, and all raw results) is in the earlier mentioned tarball. Adam Ashley


« previous php.pear.dev (#47424) next »