|
Posted by Colin McKinnon on 03/23/07 22:42
David T. Ashley wrote:
>
> The included files never contain any code that gets executed directly (it
> is all in functions, which are then called from the code in the page that
> is doing the including).
>
V. Sensible.
> I've always found PHP to be very fast, but in large projects a large
> number
> of files with a lot of functions could be included. I have to assume that
> the PHP interpreter requires some time to parse each include file.
>
Sort of. It's got to parse the code whether its in one big file or fifty
small ones. Actually, that's not true all the time either - if you use a
code cache it doesnt't have to parse each file every time - and greater
granularity improves caching effectiveness.
There is a small overhead from loading additional files but I think its
usually worth spending on hardware what you're saving on programmer time.
> b)What is the best paradigm for managing include files?
>
It depends. If you're using php5 an OO programming then fitting your include
files around the autoloader is a very good idea. If you run mutliple
different environments for development, testing, staging and publishing
then a hierarchy of include directories in your include_path allows you to
override different files at different stages of the deployment.
You might as well ask what's the best of car to buy - its the same answer,
the one that's right for you.
HTH
C.
> Thanks, Dave.
[Back to original message]
|