> Rob Paxon <mailto:[EMAIL PROTECTED]> > on Monday, March 15, 2004 9:24 PM said: > >> Bear with me while I dish out some details. My question concerns the >> efficiency of using multiple file includes versus storing segments of >> data in one include as arrays or functions. > > have you considered the size of your includes? maybe cutting the size > down by splitting them into more concise files would help? in this way > you could more precisely include what you needed and leave the rest > out.
Sometimes having less included files with more content is more efficient than having a lot of small files, an example would be making a seperate include for each function, this has its advantages especially in smarty's case but can be inefficient because you must fetch each file from disk which has overhead. I'd suggest profiling your code, use the PEAR Benchmark class and use PHP's memory usage functions to determine what parts of your code are consuming the most resources and taking the longest amount of time to execute, then try some experiments and profile each experiment to determine the most efficient solution. Different versions of PHP, different application frameworks, and applications in general will respond to optimization techniques differently, for example there is little sense in spending 40 hours optimizing variable usage in a program to increase performance when 75% of the program is database server bound, your time would be better spent optimizing the SQL. In my commericial websites I have modified my application framework not to connect to the database, start output buffering, start the session and do other overhead if specific constants are declared. For example if I have contact.php that does some mailing stuff and requires Smarty I can define TEMPLATE_ONLY and only templating related files will be included and initialized. Doing this optmization made pages roughly 50% faster that did not require session or a database connection and also reduces the load on the sql server because you are not connecting unless you actually need the connection and still benefit from having a single connection call instead of connecting in each function or file. > > just a thought. > > > chris. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php