Re: Question about including files and server load

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Jay Paulson" <jpaulson@xxxxxxxx> wrote in message 
news:1247.198.214.140.171.1129296117.squirrel@xxxxxxxxxxxxxxx
>I just started working with a new company and they handed me some of their
> php code for me to look over.  I noticed that they have a TON of include
> files being called into their scripts.  For example, instead of having one
> file called functions.php and then having all their functions in that one
> file they have put each function into it's separate file and then have a
> define_functions.php file that creates each function.  However, within the
> function itself it declared something like this:
>
> function xyz($abc) { return include(xyz_func.php); }
> function abc($xyz) { return include(abc_func.php); }
>
> I was wondering isn't this putting a bigger load on a server by including
> so many files for each function?  Also, I was wondering what everyone's
> opinion was on this approach in terms of maintenance.  Do you think it's
> better practice to put all your functions in one file or do it in this
> manner?

Fascinating!

The concept is that only the code that actually gets executed is ever 
loaded/compiled.  Pretty sneaky!
IF you had a gargantuan amount of code, that was tightly tied together --  
yet, typically not much of it was really used on most pages -- this is a 
pretty good design.  I would be interested in some timing tests, but I'm 
sure there is a point when this type of design would actually decrease the 
load on the server (because, the only code that needs to be compiled is the 
code that is executed).

DanB

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux